accept (HTML attribute)
Example
Here, the
accept attribute is used in a file upload
input:
<input type="file" name="picture" id="picture"
accept="image/jpeg"/>
Description
The
accept attribute is used to filter the types of
files that can be submitted through a file upload input. Browser support
for this attribute is inconsistent, however, and the job of validating
file uploads is best left to the server.
Value
The attribute takes a MIME type in the
format type/subtype—for example, "text/html",
"image/x-rgb", or
"application/java". Multiple values can be applied, but
they must be comma-separated.
Compatibility
| IE | 5.5 | Buggy |
|---|---|---|
| 6.0 | Buggy | |
| 7.0 | Buggy | |
| Firefox | 1.0 | Buggy |
| 1.5 | Buggy | |
| 2.0 | Buggy | |
| Safari | 1.3 | Buggy |
| 2.0 | Buggy | |
| 3.0 | Buggy | |
| Opera | 9.2 | Buggy |
This element is poorly supported and should not be relied upon.
User-contributed notes
There are no comments yet.
Add a note
To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.

