You are here: Reference > HTML > attributes > accept (form, input:file)

accept attribute (form, input:file)

Browser support:
Sets a comma-separated list of accepted content types.
This attribute is useful if you want to add a file type filter to the file open dialog.

Although all browsers support the accept attribute, but only Opera implements its functionality; it has no effect in other browsers.
JavaScript page for this attribute: accept. You can find other example(s) there.

Possible values:

String that sets a comma-separated list of media types. See the page for the MIME types for more information.
Default: this attribute has no default value.

Example HTML code 1:

This example illustrates the use of the accept attribute:
<input type="file" size="20" accept="video/mpeg" />
<input type="file" size="20" accept="image/gif" />
Did you find this example helpful? yes no

Supported by tags:

External links:

User Contributed Comments

Post Content

Post Content