<input type="file">
The <input type="file"> HTML element shows a file picker from which users can choose a file to upload with the form.
Overview
The <input type="file"> HTML element shows a file picker from which users can choose a file to upload with the form.
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
| 2 | 12 | 3 | 4 | 18 | 3 | |
| HTML attribute | ||||||
| input elements with type="file" let the user choose one or more files from their device storage. Once chosen, the files can be uploaded to a server using form submission, or manipulated using JavaScript code and the File API. | 1 | 12 | 1 | 1 | 18 | 1 |
1+Supported (version) Not supported ※Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)
Notes 1 item(s)
Implementation note
- You can set as well as get the value of `HTMLInputElement.files` in all modern browsers; this was most recently added to Firefox, in version 57 (see bug 1384030).
Syntax
HTML
<label>File selection:
<input type="file" accept="image/*">
</label>
<label>Multiple files:
<input type="file" multiple accept=".pdf,.doc,.docx">
</label> Live demo
Accept attribute. Example
filetype MIMEtype or extendedchild in specified. with accept
PreviewFullscreen
Use cases
Using <input type="file">
The <input type="file"> HTML element shows a file picker from which users can choose a file to upload with the form.
Cautions
- May not be supported in older browsers.
Accessibility
- Verify how this element is announced by screen readers.
Related links
Powered by web-features