HOME HTML CSS JAVASCRIPT SQL PHP JQUERY XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

HTML <input> accept Attribute

HTML input Tag Reference HTML <input> tag

Example

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

<form action="demo_form.asp">
  <input type="file" name="pic" accept="image/*">
  <input type="submit">
</form>

Try it yourself »

Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The accept attribute is supported in Internet Explorer 10, Firefox, Opera, Chrome, and Safari 6.

Note: The accept attribute of the <input> tag is not supported in Internet Explorer 9 and earlier versions.


Definition and Usage

The accept attribute specifies the types of files that the server accepts (that can be submitted through a file upload).

Note: The accept attribute can only be used with <input type="file">.

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


Differences Between HTML 4.01 and HTML5

NONE.


Syntax

<input accept="audio/*|video/*|image/*|MIME_type">

Tip: To specify more than one value, separate the values with a comma (e.g. <input accept="audio/*,video/*,image/*" />.

Attribute Values

Value Description
audio/* All sound files are accepted
video/* All video files are accepted
image/* All image files are accepted
MIME_type A valid MIME type, with no parameters. Look at IANA MIME types for a complete list of standard MIME types


HTML input Tag Reference HTML <input> tag

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE