Neat trick... Do all browsers support the filesize attribute tho?
> -----Original Message----- > From: Mark Smyth [mailto:[EMAIL PROTECTED] > Sent: 28 May 2004 09:59 > To: '[EMAIL PROTECTED]' > Subject: RE: [ cf-dev ] Checking image size > > > Thanks, its just for images uploads only > > Got the code below working and it seems to do the trick.. > > Mark > > <html> > <head><title>Check Images</title></head> > <body> > <form action="" enctype="multipart/form-data" > name="formData" id="formData"> > <input type="file" name="uploadfile" > onchange="setdumy(value)"> </form> <img > style="visibility:hidden;position:absolute;" id=dumy > onload="checksize()"> > > <script language="javascript"> > function setdumy(file) > { > dumy.src=file; > } > > function checksize() > { > if (dumy.fileSize>51200) > { > formData.reset(); > alert("fileSize should be less than 50K!"); > } > } > </script> > > </body> > </html> > > > > -----Original Message----- > From: Stuart Robinson [mailto:[EMAIL PROTECTED] > Sent: 28 May 2004 08:40 > To: [EMAIL PROTECTED] > Subject: Re: [ cf-dev ] Checking image size > > > If you want to read the file properties, use DHTML to create > an IMG element and assign the src from the input field. This > will work with images, though I'm not sure about other file types. > > Hope this helps. > > > > ----- Original Message ----- > From: "Mark Smyth" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Friday, May 28, 2004 9:14 AM > Subject: RE: [ cf-dev ] Checking image size > > > Hi > Thought as much, just wanted to check. > > Many Thanks > Mark > > -----Original Message----- > From: Alistair Davidson [mailto:[EMAIL PROTECTED] > Sent: 28 May 2004 08:12 > To: [EMAIL PROTECTED] > Subject: RE: [ cf-dev ] Checking image size > > > Mark, > > Short answer - No > > Javascript runs in the browser, and has no access to the > local filesystem, for very sound security reasons. I may be > wrong, but last time I checked it was the same situation with > Java applets. You can get round these restrictions with an > ActiveX control, or by exploiting one or two security holes > in Internet Explorer, but I wouldn't recommend it. > > > Sorry > > Alistair > > Alistair Davidson > Senior Technical Developer > Headshift.com > Smarter, Simpler, Social > > > -- > These lists are syncronised with the CFDeveloper forum at > http://forum.cfdeveloper.co.uk/ > Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ > > CFDeveloper Sponsors and contributors:- > *Hosting and support provided by CFMXhosting.co.uk* :: > *ActivePDF provided by activepdf.com* > *Forums provided by fusetalk.com* :: *ProWorkFlow provided by > proworkflow.com* > *Tutorials provided by helmguru.com* :: *Lists hosted by > gradwell.com* > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > -- > These lists are syncronised with the CFDeveloper forum at > http://forum.cfdeveloper.co.uk/ > Archive: > http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ > > CFDeveloper Sponsors and contributors:- > *Hosting and support provided by CFMXhosting.co.uk* :: > *ActivePDF provided by activepdf.com* > *Forums provided by fusetalk.com* :: *ProWorkFlow provided by > proworkflow.com* > *Tutorials provided by helmguru.com* :: *Lists hosted by > gradwell.com* > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > -- > These lists are syncronised with the CFDeveloper forum at > http://forum.cfdeveloper.co.uk/ > Archive: > http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ > > CFDeveloper Sponsors and contributors:- > *Hosting and support provided by CFMXhosting.co.uk* :: > *ActivePDF provided by activepdf.com* > *Forums provided by fusetalk.com* :: *ProWorkFlow provided by > proworkflow.com* > *Tutorials provided by helmguru.com* :: *Lists hosted by > gradwell.com* > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > -- > These lists are syncronised with the CFDeveloper forum at > http://forum.cfdeveloper.co.uk/ > Archive: > http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ > > CFDeveloper Sponsors and contributors:- > *Hosting and support provided by CFMXhosting.co.uk* :: > *ActivePDF provided by activepdf.com* > *Forums provided by fusetalk.com* :: *ProWorkFlow > provided by proworkflow.com* > *Tutorials provided by helmguru.com* :: *Lists > hosted by gradwell.com* > > To unsubscribe, e-mail: [EMAIL PROTECTED] > -- These lists are syncronised with the CFDeveloper forum at http://forum.cfdeveloper.co.uk/ Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ CFDeveloper Sponsors and contributors:- *Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by activepdf.com* *Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com* *Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com* To unsubscribe, e-mail: [EMAIL PROTECTED]
