file selection box

<input type="file">

Internet Explorer Firefox Opera
Inline-block Empty

The INPUT element defines an input field. When you specify "file" for the type attribute of this element, a file selection box is created.

<input type="file" name="example1">

<input type="file" name="example2" size="30">

Attribute Value Explanation
type=" " file the type of input field
name=" " field name a unique name for the field
size=" " number of chars the input field width

When the file selection box is used, the FORM element is set as follows.

<form method="POST" action="example.cgi" enctype="multipart/form-data">

method : POST
enctype : multipart/form-data


Creates a file selection box on the form.

When the value of the type attribute is "file", the browse button is displayed next to the input box.

When this button is clicked, the file selection dialog box is displayed.


The field name is used to identify the form field.


The input field width is specified by the number of characters.

Tips and Notes

The style of the input field can be changed with CSS. Please see the "Related Document" for details on CSS.


<form method="POST" action="example.cgi" enctype="multipart/form-data">

<input type="file" name="example1"></p>

<input type="file" name="example2" size="30"></p>




This form cannot submit because of a sample.