The File.type property is an inbuilt function of File WebAPI which gives the media type (MIME) of the file represented by a file object.
var name = file.type;
Return Value: It returns a string containing media type (MIME) indicating the type of the file. For example: “image/png” for PNG images.
Supported Browsers: The browser supported by WebAPI File.type property are listed below:
- Google Chrome 13.0
- Firefox 3.6
- Opera 16.0
- Internet Explorer 10.0
- PHP | filetype( ) Function
- How to get file input by selected file name without path using jQuery ?
- How to reset selected file with input tag file type in Angular 9?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.