THE WORLD'S LARGEST WEB DEVELOPER SITE

HTML <input type="file">

❮ HTML <input> type attribute

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">

❮ HTML <input> type attribute