title: Validate file size using java script
body: <p>I am trying to validate file size, which I am trying to upload by a File Upload Control.
  To validate the size of the file, I am using java script code. But it is throwing run time error. Please somebody help me.</p>
  
  <pre><code>&lt;script language="javascript" type="text/javascript"&gt;
      function getSize() {
          var myFSO = new ActiveXObject("Scripting.FileSystemObject");
          var filepath = document.upload.file.value;
          var thefile = myFSO.getFile(filepath);
          var size = thefile.size / (1024 * 1024);
          alert(size + "MB");
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>Error message : Microsoft JScript runtime error: Automation server can't create object</p>