HTML Attributes
HTML accept attribute
Hints which files a file picker should offer, using extensions, MIME types or supported wildcards. It does not validate uploaded content; check files on the server. Applicable elements include: <input>. Check each element’s value rules.
Formal Syntax & Structure
html syntaxhtml
accept="image/*,.pdf"Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| accept | comma-separated file types | Hints which files a file picker should offer, using extensions, MIME types or supported wildcards. It does not validate uploaded content; check files on the server. |
Working Example
Example Snippethtml
<label> Photo <input type="file" accept="image/*,.pdf"></label>Browser Compatibility
Minimum supported versions across modern rendering engines
Widely Available (2015)
Blink (modern)
Chrome
1
Yes
EdgeHTML / Blink
Edge
12
Yes
Gecko
Firefox
1
Yes
WebKit
Safari
1
Yes
Presto / Blink
Opera
≤12.1
Yes
Support for accept on input; picker behavior varies.
HTML Living Standard