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:

AttributeDescriptionNew in HTML5
acceptSpecifies the set of mime-types that will be accepted. RFC2046 defines MIME types (http://tools.ietf.org/html/rfc2046).No
multiplethis attribute specifies that the input element can upload multiple files. (mainstream browsers supporting is limited)Yes
requiredmark 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>
  
Click to view this demo.
Home 
  HTML CSS Book 
    HTML  

input Restricted:
  1. Using the input Element to Restrict Data Entry
  2. Using the input element to obtain a number
  3. Using input Element to Obtain a Number in a Given Range
  4. Using the input Element to Obtain a Boolean Response
  5. Using the input Element to Create Fixed Choices
  6. Using the input Element to Obtain email address
  7. Using the input element to obtain telephone number
  8. Using the input Element to Obtain url
  9. Using the input element to obtain times and dates
  10. Using the input Element to Obtain a Color
  11. Using the input Element to Obtain Search Terms
  12. Using the input element to create hidden data items
  13. Using the input Element to Create Image Buttons and Maps
  14. Using the input element to upload files
Related: