← System Design

Design a File Upload UI

easy
Asked at
Dropbox
Figma
Notion
Dropbox, Figma, Notion

Problem statement

Design a drag-and-drop file uploader with client-side validation, XHR progress tracking, concurrent uploads, instant image previews, and cancellation.

Asked In

DropboxGoogle DriveFigmaNotionSlackAWS S3 Console

Key Challenges

  • ·Drag-and-drop with accurate visual feedback and drop-zone boundary detection
  • ·XHR upload progress events for per-file upload progress bars
  • ·Concurrent upload queue with configurable parallelism (e.g., 3 at a time)
  • ·Cancellation of in-flight uploads without leaving partial files on server
  • ·Image previews generated client-side before upload completes
★

2-Minute Answer — High-Level TL;DR

Read this before your interview

HLD Interview Focus

Represent each upload as a queued, uploading, successful, failed, or canceled job, with a concurrency limit and per-file retry. Validate size and type on both client and server. Use an upload API such as XMLHttpRequest when browser upload progress events are required; ordinary fetch does not offer equivalent upload progress callbacks. A single presigned PUT can be canceled and restarted, but resumability requires a multipart or resumable protocol plus server session state. Persist metadata if useful, but after refresh the browser may need the user to reselect the file. Declare success only after storage and required server finalization complete.

→

My Approach: Building the Solution

How to think about this problem

Choose the upload protocol and define job state transitions first. Then connect progress, retry, cancellation, and server cleanup to those transitions.

Why This Approach?

A progress bar cannot provide resumability by itself. Multipart uploads enable retrying individual parts but require durable session state and cleanup. Canceling browser work does not automatically delete partial server objects or complete server validation.

Uploads are airport baggage carts: each bag has a tag (job id), a belt with limited lanes (concurrency), and a scan at the end (etag). You do not tell the passenger their bag arrived until the scan beeps.

R

Requirements: What Makes a Great Solution?

Clarify scope before designing anything

Requirements Exploration Questions

Ask your interviewer these questions to refine requirements

What file types and size limits?

  • ·Images only (JPEG, PNG, WebP, AVIF) vs any file type
  • ·Max file size per file (e.g., 100MB, 5GB)
  • ·Max total batch size
  • ·Whether MIME type validation is client-side only or server-validated too

What upload destination — presigned URLs or direct API?

  • ·Presigned S3 URLs (upload bypasses app server)
  • ·Direct POST to app server (simpler but server bottleneck)
  • ·Multipart upload for files > 100MB

What concurrency and retry requirements?

  • ·Max parallel uploads (typically 3)
  • ·Retry count on failure (typically 3 with exponential backoff)
  • ·Resume on network reconnect vs restart

What metadata is needed alongside the file?

  • ·Filename, MIME type, size — automatically from File API
  • ·User-provided tags, descriptions, folder targets
  • ·Whether to create a DB record before or after upload

Functional Requirements

Must Have — MVP

  • ✓Drag-and-drop zone with visual feedback (dragenter/dragleave/drop)
  • ✓File picker button as accessible fallback
  • ✓Per-file progress bar driven by XHR upload progress events
  • ✓Concurrent upload queue (max 3 parallel)
  • ✓Per-file cancel button (aborts in-flight XHR)
  • ✓Client-side image thumbnail preview
  • ✓Error state per file with retry button
  • ✓File type and size validation before upload starts

Advanced (If Time Permits)

  • +Chunked uploads with resume-on-failure (TUS protocol or custom)
  • +Folder drag-and-drop (webkitGetAsEntry API)
  • +Clipboard paste upload (paste event on window)
  • +Upload speed estimate and ETA display

Non-Functional Requirements

Performance

  • ·Image preview generated < 100ms after file selection
  • ·Upload queue starts within 50ms of file drop
  • ·Progress bar updates at 60fps without layout thrash

Reliability

  • ·3 retries with exponential backoff per file on network error
  • ·Cancelled uploads do not leave partial objects on server (server-side cleanup or abort multipart)
  • ·Duplicate file detection (hash or name+size check before upload)

Accessibility

  • ·File picker button keyboard-accessible
  • ·Upload progress announced via aria-live='polite'
  • ·File picker button works with keyboard; drag-and-drop is an optional mouse/pointer shortcut

Security

  • ·Validate metadata before issuing a URL, then inspect the uploaded file server-side before making it available
  • ·Presigned URL scoped to specific bucket/key and expires in 15 minutes
  • ·File size limit enforced by server, not just client
Premium

The full solution is part of HelloFrontend Pro

The question above is free to read in full. Upgrade to unlock the interactive workspace and the senior-level walkthrough that go with it.

  • Full RADIO-framework walkthrough with architecture diagrams
  • Data model, API design, and rendering strategy trade-offs
  • Performance, accessibility, and offline sections plus a model answer
Unlock the full solution →

Already a member? Log in to open the workspace.

More System Design questions

View all System Design →