HTML <input> accept Attribute
Specify that the server accepts only image files in the file upload:
<input type="file" name="pic" accept="image/*">
Try it yourself »
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
Tip: To specify more than one value, separate the values with a comma (e.g. <input accept="audio/*,video/*,image/*" />.
|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
Thank You For Helping Us!
Your message has been sent to W3Schools.