<input type="file">: How to Use This HTML Value

Disclosure: Your support helps keep the site running! We earn a referral fee for some of the services we recommend on this page. Learn more
Value of
How To Define Input Type In HTML (All The Values And Attributes)
What does <input type="file">: How to Use This HTML Value do?
Defines a file upload box with a browse button.

Code Example

<form action="myform.cgi">
<input type="file" name="fileupload" value="fileupload" id="fileupload">
<label for="fileupload"> Select a file to upload</label>
<input type="submit" value="submit">
</form>

In a form, the file value of the type attribute allows you to define an input element for file uploads. This displays a browse button, which the user can click on to select a file on their local computer.

Once a file has been selected, the file name appears next to the button.

Claire is seasoned technical writer, editor, and HTML enthusiast. She writes for HTML.com and runs a content agency, Red Robot Media.

Browser Support for file

iefirefoxchromeedgesafariopera
AllAllAllAllAllAll