Specify that the server accepts only image files in the file upload:
![]()
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.
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.
NONE.
Tip: To specify more than one value, separate the values with a comma (e.g. <input accept="audio/*,video/*,image/*" />.
| 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
Your message has been sent to W3Schools.