[Javascript] Checking local file size

David T. Lovering dlovering at gazos.com
Tue Apr 1 21:39:58 CST 2003


Yes, it is supposed to be signed -- but most fileUpload procedures are built
(albeit loosely) on signed scripts.  Try signing it, and exciting things 
should happen.

-- Dave

"Lau at goldenweb.com.au" wrote:
> 
> I tried your code but I keep getting "Error:File is undefined".
> 
> Isn't there something about it having to be a signed script or something?
> Otherwise I could read every file on a clients machine when they came to my
> site which I don't think should be allowed.
> 
> Peace
> Lau
> 
> ----- Original Message -----
> From: "David T. Lovering" <dlovering at gazos.com>
> To: "[JavaScript List]" <javascript at LaTech.edu>
> Sent: Wednesday, April 02, 2003 12:33 PM
> Subject: Re: [Javascript] Checking local file size
> 
> >
> > 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
> > _______________________________________________
> > Javascript mailing list
> > Javascript at LaTech.edu
> > https://lists.LaTech.edu/mailman/listinfo/javascript
> 
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript


More information about the Javascript mailing list