1. Technology

<input type="file">


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

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:

©2014 About.com. All rights reserved.