Skip to main content
InputLevel 2

File Upload

文件上传

WebMobileDesktopDifficulty: Medium

Lets the user get a file from their device into your app, with progress, cancellation, and retry along the way.

01

Live Demo

Actually clickable

Click to choose, or drag a file here

JPG / PNG · Up to 10MB each

Uploading isn't just "pick a file" — progress, cancelling, and retrying on failure are the real experience.

What you just saw:Picking an image in a chat app, importing photos from a gallery app, the "Upload avatar" box in an admin panel, the dashed drop zone in a web form.

02

What it actually is

The real difficulty of file upload lives in the "uploading" and "failed" states. Success is visible by itself; failure is routinely ignored. A competent upload control needs progress, cancellation, retry on failure, and a clear statement of format and size limits.

file uploaduploaddrop zonedrag-and-drop uploadattachment uploadfile picker
03

Anatomy · What it's made of

  1. Drop Zone拖拽区

    Dashed border, supports both click and drop

  2. File List文件列表

    Thumbnail + name + size

  3. Progress上传进度

    A progress bar plus a percentage

  4. Cancel / Retry取消/重试

    Cancelable while running, retryable after a failure

  5. Constraint限制说明

    Format, size, and count limits

04

When to Use

When it fits, and when it doesn't
File Upload usage recommendations
SituationUse it?
You need to receive images, documents, or media filesYes
Both drag-and-drop and click-to-pick should workYes
Large files need visible progress and a way to cancelYes
Only one image is needed (avatar, cover)Depends

On mobile, request photo and file permissions up front — and when permission is denied, explain why and link to Settings.

Always state the format and size limits before the upload starts, never after the user has waited five minutes.

05

Similar Patterns

Don't mix these up
06

How to tell AI

Three levels of prompt

Add the component name and specifics

Add an image upload zone: supports click and drag, accepts jpg/png only, caps each file at 10MB, and shows a thumbnail and progress bar per file with cancel and retry.

07

Don't just say this to AI

Bad → Better

Don't say this to AI

Add an upload button for files.

Say this instead

Add a file upload zone: supports click and drag, accept limits the format, size is validated on the client, each file shows a thumbnail + progress bar + cancel button, failures can be retried, and the format and size limits are stated up front.

08

Share this card

Social-ready

Turn this pattern into a 3:4 or 1:1 knowledge card and export it as PNG right in the browser. No backend needed.