[Javascript] Checking local file size

David T. Lovering dlovering at gazos.com
Tue Apr 1 20:33:35 CST 2003


Dear Lau:

  There is no way to read the file length passively without opening it, insofar
as I know.  However, it is easy to find the length ONCE you've opened it for
reading:

	var myFile = new File("c:\temp\myfile.txt");
    myFile.open("r");
    alert('myFile length: ' + myFile.getLength());

  This should work well, and you can always close the file immediately thereafter.

  -- Dave Lovering

"Lau at goldenweb.com.au" wrote:
> 
> Hi,
> 
> I have an ASP program that lets a user upload a file (using ASPUpload). But
> now I want to check the size of the file before they upload it so I can put
> an upper limit on the size of files they can upload.
> 
> Is there a way I can check the size of a file on the users local drive using
> javascript? If not what other methods are available?
> 
> Thanks in advance
> Lau
> 
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript


More information about the Javascript mailing list