Using the input element to upload files
The type='file' input element uploads files to the server as part of the form submission. This type ='file' input supports the additional attributes:
Attribute | Description | New in HTML5 |
---|---|---|
accept | Specifies the set of mime-types that will be accepted. RFC2046 defines MIME types (http://tools.ietf.org/html/rfc2046). | No |
multiple | this attribute specifies that the input element can upload multiple files. (mainstream browsers supporting is limited) | Yes |
required | mark as required field for input validation. | Yes |
<!DOCTYPE HTML>
<html>
<head>
<title>Example</title>
</head>
<body>
<form method="post" action="http://yourServer/form"
enctype="multipart/form-data">
<input type="hidden" name="recordID" value="1234" />
<p>
<label for="name"> Name:
<input value="Mark" id="name" name="name" />
</label>
</p>
<p>
<input type="file" name="filedata" />
</p>
<input type="submit" value="Submit" />
</form>
</body>
</html>
Home
HTML CSS Book
HTML
HTML CSS Book
HTML
input Restricted:
- Using the input Element to Restrict Data Entry
- Using the input element to obtain a number
- Using input Element to Obtain a Number in a Given Range
- Using the input Element to Obtain a Boolean Response
- Using the input Element to Create Fixed Choices
- Using the input Element to Obtain email address
- Using the input element to obtain telephone number
- Using the input Element to Obtain url
- Using the input element to obtain times and dates
- Using the input Element to Obtain a Color
- Using the input Element to Obtain Search Terms
- Using the input element to create hidden data items
- Using the input Element to Create Image Buttons and Maps
- Using the input element to upload files
Related: