Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML input accept attribute

HTML The accept attribute

HTML input Tag Reference HTML tag

Example

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

 

 

Try it »


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

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 tag.


Definition and Usage

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

**Note:** The accept attribute applies only to the .

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


Differences between HTML 4.01 and HTML5

none.


Syntax

**Tip:** To specify multiple values, separate them with commas (such as ).

Attribute values

Value Description
audio/* Accepts all audio files.
video/* Accepts all video files.
image/* Accepts all image files.
MIME_type A valid MIME type, without parameters. See IANA MIME Types, for a complete list of standard MIME types.

HTML input Tag Reference HTML tag