The Current State of HTML5 Forms

The accept Attribute

<input type=file accept="image/*">

Live Demo

Firefox
11+
Safari
5.2+
Safari Mobile
any
Chrome
10+
Opera
10.6+
IE
10+
Android
2.3-
Supported Supported N/A Supported Kinda supported Supported No support

Supported Browser Screenshots

Chrome 10
Opera 11 (Vista)

Unsupported Browser Screenshots

Firefox 4b12 (Mac)

The Low Down

The accept attribute is supposed to limit the file selection dialog to files with certain MIME types.

  • Types: audio/*, video/*, image/*, or other valid MIME types with no parameters.
  • Fallback is that input accepts files of any type.
  • Opera 10.6 - 11.61: report acceptance of the attribute, but it only actually works on PCs (not Macs).
  • Not supported on Firefox 4 for Mac, but is supported on Firefox 4 for Windows and Linux.
  • Somewhere between version 4 and 11 of Firefox it started working on Mac too.
  • Macs "gray out" improper selections in the file selection dialog, PCs just don't show them all together.
  • IE 9 will take the attribute but doesn't actually work.
  • Started working Safari somewhere between 5.0.3 and 5.2
  • iOS doesn't really have a file browser so it just grays out all file input types. It would be nice if it allowed attaching a photo or document stored somewhere on the device.
  • Android 2.3 (tested on Kindle Fire), when clicking on a file input, offers a dialog to choose a file from Gallery or Quickoffice. Ignores accept attribute.