Skip to content
fa
Search Frontend Atlas
Search questions and concepts across the handbook.
UI Engineering & Machine Codingadvanced12 min read

How do you build a resilient file-upload experience?

Cover validation, progress, cancellation, retries, resumability, server verification, and duplicate submission.

Uploading a file is not one operation from the user’s point of view. The file may need validation, transfer, server-side processing and confirmation before it is actually usable. Networks drop, tabs close and users retry, so a good upload flow has to know which stage completed and how to resume without duplicating work.

Uploading a file is not one operation from the user’s point of view. The file may need validation, transfer, server-side processing and confirmation before it is actually usable. Networks drop, tabs close and users retry, so a good upload flow has to know which stage completed and how to resume without duplicating work.

The quick version

Validate file metadata for user feedback, but enforce type, size, authorization, and content safety on the server. Model upload lifecycle explicitly and make retry/cancel behavior clear.

Build the mental model

The browser-provided MIME type and filename are untrusted. Large uploads may need multipart/resumable protocols, checksums, and server-side assembly. A retry must not accidentally create duplicate resources; use an upload session or idempotency key.

See it in code

const form = new FormData();
form.append('file', file, file.name);
await fetch('/uploads', { method: 'POST', body: form, signal });

Where it gets tricky

A reliable upload flow distinguishes selection, validation, transfer, server processing, completion, and failure. A successful transfer may still be followed by virus scanning or media processing. For multipart uploads, persist the upload session and part state, verify checksums, and ensure abandoned sessions are eventually cleaned up server-side.

A common misunderstanding

An <input accept> attribute is a picker hint, not validation or security.

What this changes in an application

Plan for network loss, tab closure, expired sessions, duplicate clicks, storage limits, and server cleanup of abandoned multipart uploads.

Questions worth exploring next

  • How would you resume after a tab reload?
  • How do you verify the file contents server-side?

References and next steps