JavaScript WebAPI File.type Property Last Updated : 30 Sep, 2024 Comments Improve Suggest changes Like Article Like Report 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. Syntax:let 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. Example: Below is the implementation of JavaScript WebAPI File.type Property. html <!DOCTYPE html> <html> <head> <title> WebAPI File.type </title> <style> #test { padding: 10px; width: 300px; border: 1px solid green; text-align: center; font-size: 22px; } </style> </head> <body> <div id="test"> <div>GeeksforGeeks</div> <div>file.type</div> <input type="file" multiple onchange="myGeeks(this)"> </div> <script type="text/javascript"> function myGeeks(fileInput) { let files = fileInput.files; for (let i = 0; i < files.length; i++) { let file_name = files[i].name; let file_type = files[i].type; alert("Filename: " + file_name + ", Type: " + file_type); } } </script> </body> </html> Output:Supported Browsers: The browser supported by WebAPI File.type property are listed below: EdgeGoogle Chrome 13.0Firefox 3.6Opera 16.0Safari Comment More infoAdvertise with us Next Article JavaScript WebAPI File.type Property S sarthak_ishu11 Follow Improve Article Tags : JavaScript Web Technologies Similar Reads JavaScript WebAPI File.size Property The file.size property is an inbuilt function of file WebAPI which gives the size of a file in bytes. Syntax:let size = instanceOfFile.size;Return Value: It returns a number, containing the size of the file in bytes. Example: This example shows the implementation of the JavaScript WebAPI File.size P 1 min read JavaScript File.name Property The File.name property is an inbuilt function of File WebAPI which gives the name of the file represented by a file object. The path of file is excluded from this property for security reasons. Syntax:letname = file.name;Return Value: It returns a string, containing the name of the file without path 1 min read HTML | DOM Input FileUpload type Property The Input FileUpload type Property is used in HTML DOM to return the type of form element the file upload button is. This property will always return "file" for a file upload button. Syntax: fileuploadObject.type Return Value: It returns a string value that represents the type of form element the fi 1 min read HTML | DOM Object type Property The HTML | DOM Object type Property is used to set or return the value of a type attribute of a <object> element. The type attribute is used to specify the Internet type of MIME type of the Object. Syntax: It returns the type property.objObject.typeIt is used to set the type property.objObject 1 min read HTML | DOM Link type Property The DOM Link type Property is used to set or return the content type or MIME type of the linked Document. For eg. text/css", "text/javascript", "image/gif", etc. Syntax: It returns the type property.linkObject.typeIt is used to set the type property.linkObject.type = MIME-type Property Values: It co 1 min read Like