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).
The selected filename(s) will display next to the input control.
<form action="/tutorial/fileupload.html" enctype="multipart/form-data">
<fieldset>
<legend>Select and Upload images</legend>
<input type="file" name="file"
accept="image/*" multiple><br /><br />
<input type="submit" value="Upload">
</fieldset>
</form>
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">
Here is when type="file"
support started for each browser:
Chrome
|
1.0 | Sep 2008 |
Firefox
|
1.0 | Sep 2002 |
IE/Edge
|
1.0 | Aug 1995 |
Opera
|
1.0 | Jan 2006 |
Safari
|
1.0 | Jan 2003 |
Back to <input>