HTML <input> type="file"

The <input> tag with a type="file" attribute creates a file selection control.

Clicking it will open file-selection dialog.



An <input> element of type file.
Select one or more image files and then click Upload to upload the file(s).

Select and Upload images

The selected filename(s) will display next to the input control.

<form action="/tutorial/fileupload.html" enctype="multipart/form-data">
   <legend>Select and Upload images</legend>

   <input type="file" name="file"
          accept="image/*" multiple><br /><br />

   <input type="submit" value="Upload">

Using input type="file"

The <input type="file"> specifies a file selection control.

This element is rendered with a button and label, although in each browser it looks different.

The button opens a file selection dialog, and the label will display the selected filename(s).

Adding the multiple attribute will allow selecting multiple files in the dialog.


<input type="file">

Browser support

Here is when type="file" support started for each browser:

1.0 Sep 2008
1.0 Sep 2002
1.0 Aug 1995
1.0 Jan 2006
1.0 Jan 2003

You may also like

 Back to <input>

Last updated on Sep 30, 2023