1. Computing

Discuss in my forum

<input type="file">

By

INPUT File Description:

The file INPUT tag provides a file upload form box for HTML forms. It allows you to solicit files from your readers such as images or video.

DTD: HTML5: <!doctype html>
HTML4 Strict: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
HTML4 Transitional or Loose: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

INPUT File Web Browser Support:

HTML Versions

INPUT File Attributes:

Global attributes, event attributes and the input tag attributes. Plus:

  • accept
  • files
  • multiple
  • required

INPUT File Usage:

Standard file upload input:

<form enctype="multipart/form-data">
<input type="file" accept="image/jpg,image/gif">
</form>

See an example of a standard file input tag.

INPUT File Special Notes:

You should always add the attribute enctype="multi-part/form-data" to your form tag when using the file input type. Otherwise, the uploaded files will not be attached correctly.

The accept attribute tells the browser what MIME types your form will allow to be uploaded.

More INPUT File Information:

  1. About.com
  2. Computing
  3. Web Design / HTML
  4. HTML and XHTML
  5. XHTML
  6. HTML Tags
  7. The INPUT File Tag - INPUT File - HTML Tag for Uploading Files

©2014 About.com. All rights reserved.