HTML <input type="file">
Example
Define a file-select field:
<label for="myfile">Select a file:</label>
<input type="file"
id="myfile" name="myfile">
Try it Yourself »
Definition and Usage
The <input type="file">
defines a file-select field and a
"Browse" button for file uploads.
To define a file-select field that allows multiple files to be selected, add the
multiple
attribute.
Tip: Always add the <label>
tag
for best accessibility practices!
Browser Support
The numbers in the table specify the first browser version that fully supports the element.
Attribute | |||||
---|---|---|---|---|---|
type="file" | 1.0 | Yes | 1.0 | 1.0 | 1.0 |
Syntax
<input type="file">