HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
Input FileUpload Object : Change the accepted content type
The accept property sets or returns the value of the accept attribute of the file upload button.
The accept attribute specifies the types of files that the server accepts (that can be submitted through a file upload).
Property | |||||
---|---|---|---|---|---|
accept | Yes | Not supported | Yes | Not supported | Yes |
Return the accept property:
Set the accept property:
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 |
Return Value: | A String, containing a comma-separated list of accepted content types |
---|
Display the accepted content type of a <input type="file"> element:
var x = document.getElementById("myFile").accept;
Accept multiple content types:
// The server will only accept audio and video files in the file upload
document.getElementById("myFile").accept = "audio/*,video/*";
HTML reference: HTML <input> accept attribute
❮ Input FileUpload Object