Get the file size from Client side JavaScript

By Santhosh N

This explains how to determine the file size of the client system file from JavaScript

The following code could be used to determine the file size from the javascript which is useful at the time of uploading where in you can check before server side processing, on the client side itself

   var fileObj = new ActiveXObject("Scripting.FileSystemObject");
   var fName = document.getElementById('file1');
   upLoadfile = fileObj.getFile(fName);
   fSize = upLoadfile.size;
  

Related FAQs

This is how trimming of a string can be done in javascript is simpler manner.
This is a way to check if the given string is in numeric format or not
Get the random number within the specified range
Get the file size from Client side JavaScript  (1606 Views)