Skip to content

Inputs

File upload

Also calledfile pickerupload fieldfile input

A control for selecting files to send to an application. It may include a drop area, but must also offer a keyboard-operable file picker.

How people describe it

  • “choose file button beside a filename”
  • “box where I attach a document”
  • “area asking me to drop a file or browse”

Good for

  • Attaching a document
  • Selecting a profile photo

Don’t mix it up with

  • Accepts typed text rather than a file selected from the device.

Accessibility checklist

  • Associate a visible label and file requirements
  • Offer keyboard file selection, not drag and drop alone
  • Announce validation errors and upload status without moving focus unexpectedly

Try it

Files stay in your browser. Nothing is uploaded.

Choose or drag files here. Files bigger than the limit are skipped.

Prompt

Add a labeled file upload with a file picker and clear file-type guidance.

~19 estimated prompt tokensDetailed: ~76 estimated prompt tokens

Rough estimate for prompt text only; actual counts vary by model and context.

<label for="attachment">Attach a PDF document</label>
<input id="attachment" name="attachment" type="file" accept=".pdf,application/pdf" aria-describedby="attachment-help" style="min-height:44px; width:100%; box-sizing:border-box">
<p id="attachment-help">Choose a PDF. Selecting a file does not upload it yet.</p>
<!-- Submit using your application's upload flow and validate the file on the server; accept is only a picker hint. -->

Used in

Explore website blueprints that use this component.