Easy Tutorial
❮ Tag Datalist Ev Onshow ❯

HTML <input> accept Attribute

HTML <input> Tag

Example

Specifies that the server only accepts image files in file uploads:


Browser Support

Internet Explorer 10, Firefox, Opera, Chrome, and Safari 6 support the accept attribute.

Note: Internet Explorer 9 and earlier versions do not support the accept attribute of the <input> tag.


Definition and Usage

The accept attribute specifies the types of files that the server accepts through file upload.

Note: The accept attribute is only applicable to <input type="file">.

Tip: Do not use this attribute as your validation tool. File uploads should be validated on the server side.


Differences Between HTML 4.01 and HTML5

None.


Syntax

Tip: To specify multiple values, use commas to separate them (e.g., <input accept="audio/*,video/*,image/*" />).

Attribute Values

Value Description
audio/* Accepts all sound files.
video/* Accepts all video files.
image/* Accepts all image files.
MIME_type A valid MIME type without parameters. See IANA MIME Types

❮ Tag Datalist Ev Onshow ❯