<input type="file">

Browser
  • IE
  • Cr
  • Sf
  • Fx
  • O
Type

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

type="file"

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.

name=""
The field name is used to identify the form field.
size=""
The input field width is specified by the number of characters.

Example


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

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

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

</form>

Output

Default

size="30"

This form cannot submit because of a sample.