JavaScript WebAPI File.size Property Last Updated : 30 Sep, 2024 Comments Improve Suggest changes Like Article Like Report 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 Property. html <!DOCTYPE html> <html> <head> <title> WebAPI File.name </title> <style> #main { padding: 10px; width: 300px; border: 1px solid black; text-align: center; font-size: 22px; } </style> </head> <body> <div id="main"> <div>GeeksforGeeks</div> <div>file.size</div> <input type="file" multiple id="file_input" onchange="myGeeks(this)"> </div> <script type="text/javascript"> function myGeeks(fileInput) { // File input let fileInput = document.getElementById("file_input"); let files = fileInput.files; for (let i = 0; i < files.length; i++) { alert(files[i].name + " has a size of " + files[i].size + " Bytes"); } } </script> </body> </html> Output:Supported Browsers: The browser supported by WebAPI File.name property are listed below: EdgeGoogle ChromeFirefoxOperaSafari Comment More infoAdvertise with us Next Article JavaScript WebAPI File.size Property S sarthak_ishu11 Follow Improve Article Tags : JavaScript Web Technologies Similar Reads JavaScript WebAPI File.type Property 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 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 JavaScript typedArray.BYTES_PER_ELEMENT Property The typedArray.BYTES_PER_ELEMENT is an inbuilt property in JavaScript that is used to return the size in bytes of each element in a given typedArray. Syntax: typedArray.BYTES_PER_ELEMENT; Parameter: It does not accept any parameter because it is a property, not a function. Return value: It returns t 1 min read Validation of file size while uploading using JavaScript / jQuery Validating the file size before uploading is an important step in enhancing user experience on a website. It helps prevent large files from being uploaded, which could lead to slow uploads, server overload, or bandwidth issues.Why File Size Validation is ImportantImproves User Experience: Prevents u 3 min read Web API DOMRect width property In Web API there is a DOMRectReadOnly Interface which has a property width that gives us the width of the DOMRect object. Syntax: let recX = DOMRect.width; Return Type: Double value Example: Getting the width of the DOMRect object created. HTML <!DOCTYPE html> <html> <head> <tit 1 min read Like