I dont think it is possible with javascript. In order for this to be true, either the script would need access to the local filesystem, which it does not...or the browser would store the filesize of the selected file somewhere accessible in the dom. That would be a very cool thing for the browser's to do, but I have never heard of this, so I very much doubt that is true either.
If all of your users are on IE and they trust you and are willing to click yes on the security warning (or you can sign the script) , you can get access to the fileSystemObject and do some scripting to get the filesize of the file they selected. Useing the fso like this is usually not acceptable, but here is the code if you want to see what it will do first hand. Stick this in your head. <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript"> <!-- function fsoGetFile(fname) { fso = new ActiveXObject("Scripting.FileSystemObject"); a = fso.GetFile(fname); alert(a.name + ' is ' + a.size + ' bytes'); return; } //--> </SCRIPT> and in the body... <form name="upload"> <input type="file" onChange="fsoGetFile(this.value);"> </form> If you are willing to spend $200 I reccomend JUpload. http://www.aspupload.com/jupload.html On a side note, this is one thing that I have always thought would be very cool for an applet like JUpload to be included with ColdFusion as uploading files is always one of the biggest problems developers have. jon ----- Original Message ----- From: "Mike Amburn" <[EMAIL PROTECTED]> To: "CF-Talk" <[EMAIL PROTECTED]> Sent: Thursday, October 25, 2001 1:14 PM Subject: RE: Checking file size before upload. > and how would you do it with JavaScript? > > -----Original Message----- > From: Joseph DeVore [mailto:[EMAIL PROTECTED]] > Sent: Thursday, October 25, 2001 1:13 AM > To: CF-Talk > Subject: RE: Checking file size before upload. > > > Javascript. > > Joseph DeVore > VeloxWeb Technologies > > > -----Original Message----- > From: Lon Lentz [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, October 23, 2001 1:07 PM > To: CF-Talk > Subject: Checking file size before upload. > > > Is there a way to check the size of a file before the server > CFFile-Uploads it? > > > > Lon Lentz > Applications Developer and CyberEntomolgist > http://Proof-it-Online.Com - Free 15 Day Trial > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists