Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting the size of a file to be uploaded

Status
Not open for further replies.

jfrost10

Programmer
Jun 3, 2001
2,004
CA
Hey guys,

Is there a way in javascript to figure out the size of a file selected with an html file upload control?

right now, the file needs to be posted to the server before our server side code can be checked. It would be great to be able to check it on the client and limit the uploads from there.

Thanks,

Jack
 
Jack,
there is no way of getting the file size of a file you are trying to upload from a PC before it actually gets uploaded. The document.fileSize atribute only works with IE4.0 and higher and only works if the file has already been loaded in the html page.
Dan
 
If you are handling the upload with an application like aspUpload the program will give you a method to determine file size before uploading (and limit maxmimum upload size) -----------------------------------------------------------------
[pc] Be nice. It's only doing what you tell it to do.
mikewolf@tst-us.com
 
Thanks guys. Unfortunately, we aren't using any program (just the html file upload control).

So how do some of the free services out there handle it when a large file is uploaded (i.e. > 10 MB)?!

Sure the server might not save it, but that still could be huge bandwidth loss while its being sent!

Thats really what we're trying to avoid: we have a VPN and limited bandwidth, and we don't want our clients uploading huge CAD files if we can avoid it, especially since they won't end up getting saved anyway.

Thanks,

jack
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top