RE: Checking file size before upload.
This is very helpful, and pretty impressive. Thank you. Ron Hornbaker [EMAIL PROTECTED] wrote in message Try as I might, I can't get your script to work. I've gone through replacing hard carriage returns with spaces where they should be (the message got wrapped), but it's not working, and not throwing any errors with IE5.5. Any chance you could put up a sample form live on the web where we could see it work? Or send it to me w/o linewraps off-list: [EMAIL PROTECTED]? Here it is: http://www.massimocorner.com/beta/js_upload.htm ~~ Get the mailserver that powers this list at http://www.coolfusion.com 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
RE: Checking file size before upload.
I don't thinks so. At least not with CF as standard. Peter Tilbrook ColdFusion Applications Developer Australia New Zealand Food Authority Boeing House 55 Blackall Street BARTON ACT 2600 Ph: +61-2-6271-2671 Fax: +61-2-6271-2278 http://www.anzfa.gov.au -Original Message- From: Lon Lentz [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 24 October 2001 6:07 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
Re: Checking file size before upload.
On Thu, 25 Oct 2001 16:51:35 +1000, Tilbrook, Peter [EMAIL PROTECTED] wrote: I don't thinks so. At least not with CF as standard. I vaguely recall writing a custom http server and cfx to handle getting raw post data... I believe I intended to allow you to set a byte-limit and have the server simple break connection if a post exceeded it. To be honest though I'm not sure if I ever finished the code or not. Been a long time. It was part of the IHTK package, secPOST/secPOSTService (?). --min ~~ 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
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 ~~ Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.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
Re: Checking file size before upload.
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
Re: Checking file size before upload.
Jon Hall [EMAIL PROTECTED] wrote in message news:016501c15d87$53a9a740 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. It's feasible, even if it's quite an hack. It works only on IE and NN 6, no NN 4. It doesn't works on the Mac either (but fails silentely in both cases). I made a Dreamweaver behavior for this, below is a sample code, hope OE will not do bad things with it: html head titleCheck File Upload/title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 script language=JavaScript !-- function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf(?))0parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])d.all) x=d.all[n]; for (i=0;!xid.forms.length;i++) x=d.forms[i][n]; for(i=0;!xd.layersid.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x d.getElementById) x=d.getElementById(n); return x; } function tmt_checkImgObj(){//v2.0 var errorMsg=; if(this.maxS!=this.fileSize/1000this.maxS){ errorMsg+=Maximum size for images is: +this.maxS+ kilobytes \n;} if(this.minS!=this.fileSize/1000this.minS){ errorMsg+=Minimum size for images is: +this.minS+ kilobytes \n;} if(this.maxW!=this.widththis.maxW){ errorMsg+=Maximum width allowed for images is: +this.maxW+ pixels \n;} if(this.minW!=this.widththis.minW){ errorMsg+=Minimum width allowed for images is: +this.minW+ pixels \n;} if(this.maxH!=this.heightthis.maxH){ errorMsg+=Maximum height allowed for images is: +this.maxH+ pixels \n;} if(this.minH!=this.heightthis.minH){ errorMsg+=Minimum height allowed for images is: +this.minH+ pixels \n;} if(errorMsg==){ if(this.fW){var fW=MM_findObj(this.fW);if(fW){fW.value=this.width;}} if(this.fH){var fH=MM_findObj(this.fH);if(fH){fH.value=this.height;}}} else{alert(errorMsg);}document.MM_returnValue=(errorMsg==); } function tmt_createImgObj(imgURL,loadHandler,minW,maxW,minH,maxH,minS,maxS,fW,fH){//v 2.0 document.MM_returnValue=false; var img=new Image();img.minW=minW;img.maxW=maxW;img.minH=minH;img.maxH=maxH; img.fW=fW;img.fH=fH;img.minS=minS;img.maxS=maxS;img.onload=loadHandler;img.s rc=imgURL; } function tmt_CheckImg(formElement,minW,maxW,minH,maxH,minS,maxS,mime,fW,fH){//v2.0 document.MM_returnValue=true;if(document.getElementById){var obj=MM_findObj(formElement); var f=obj.form.name;if(objf){var imgRex=new RegExp(\\.(+mime+)$,i);if(imgRex.test(obj.value)){ var imgURL=file:///+obj.value;tmt_createImgObj(imgURL,tmt_checkImgObj,minW,max W,minH,maxH,minS,maxS,fW,fH); eval(setTimeout(\if(document.MM_returnValue){document.+f+.submit()}\,30 0));} else{document.MM_returnValue=false;alert(Only +mime+ files are allowed);obj.focus();obj.select();}}} } //-- /script /head body bgcolor=#FF form name=form1 enctype=multipart/form-data method=post action= onSubmit=tmt_CheckImg('fileField','100','200','150','250','5','30','jpg|gif ','','');return document.MM_returnValue p input type=file name=fileField /p p input type=submit name=Submit value=Submit /p /form /body /html For a tutorial on how to use a set of Ultradev extensions for file upload check: http://www.carolinawebsolutions.com/cffileupload/ Massimo Foti [EMAIL PROTECTED] http://www.massimocorner.com Dreamweaver, Ultradev and Fireworks goodies http://www.projectseven.com/viewer/snippets.htm Snippets Panel ~~ 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
Re: Checking file size before upload.
Wow, after staring at the code scratching my head for a few minutes I finally think I get the concept of what you are doing. Basically this is taking the filename and loading the image via a file://url from the local filesystem into a frame and getting all of the relevant data and passing it back to the original page with javascript. This is a really cool idea. Without testing the code out, is this not a huge security problem? I'm thinking that as long as the browser is can handle the mime type that it would be possible to grab almost any file from the users hd using the same concept with a few modifications. jon - Original Message - From: Massimo Foti [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Thursday, October 25, 2001 4:31 PM Subject: Re: Checking file size before upload. snip It's feasible, even if it's quite an hack. It works only on IE and NN 6, no NN 4. It doesn't works on the Mac either (but fails silentely in both cases). I made a Dreamweaver behavior for this, below is a sample code, hope OE will not do bad things with it: html head titleCheck File Upload/title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 script language=JavaScript !-- function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf(?))0parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])d.all) x=d.all[n]; for (i=0;!xid.forms.length;i++) x=d.forms[i][n]; for(i=0;!xd.layersid.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x d.getElementById) x=d.getElementById(n); return x; } function tmt_checkImgObj(){//v2.0 var errorMsg=; if(this.maxS!=this.fileSize/1000this.maxS){ errorMsg+=Maximum size for images is: +this.maxS+ kilobytes \n;} if(this.minS!=this.fileSize/1000this.minS){ errorMsg+=Minimum size for images is: +this.minS+ kilobytes \n;} if(this.maxW!=this.widththis.maxW){ errorMsg+=Maximum width allowed for images is: +this.maxW+ pixels \n;} if(this.minW!=this.widththis.minW){ errorMsg+=Minimum width allowed for images is: +this.minW+ pixels \n;} if(this.maxH!=this.heightthis.maxH){ errorMsg+=Maximum height allowed for images is: +this.maxH+ pixels \n;} if(this.minH!=this.heightthis.minH){ errorMsg+=Minimum height allowed for images is: +this.minH+ pixels \n;} if(errorMsg==){ if(this.fW){var fW=MM_findObj(this.fW);if(fW){fW.value=this.width;}} if(this.fH){var fH=MM_findObj(this.fH);if(fH){fH.value=this.height;}}} else{alert(errorMsg);}document.MM_returnValue=(errorMsg==); } function tmt_createImgObj(imgURL,loadHandler,minW,maxW,minH,maxH,minS,maxS,fW,fH){//v 2.0 document.MM_returnValue=false; var img=new Image();img.minW=minW;img.maxW=maxW;img.minH=minH;img.maxH=maxH; img.fW=fW;img.fH=fH;img.minS=minS;img.maxS=maxS;img.onload=loadHandler;img.s rc=imgURL; } function tmt_CheckImg(formElement,minW,maxW,minH,maxH,minS,maxS,mime,fW,fH){//v2.0 document.MM_returnValue=true;if(document.getElementById){var obj=MM_findObj(formElement); var f=obj.form.name;if(objf){var imgRex=new RegExp(\\.(+mime+)$,i);if(imgRex.test(obj.value)){ var imgURL=file:///+obj.value;tmt_createImgObj(imgURL,tmt_checkImgObj,minW,max W,minH,maxH,minS,maxS,fW,fH); eval(setTimeout(\if(document.MM_returnValue){document.+f+.submit()}\,30 0));} else{document.MM_returnValue=false;alert(Only +mime+ files are allowed);obj.focus();obj.select();}}} } //-- /script /head body bgcolor=#FF form name=form1 enctype=multipart/form-data method=post action= onSubmit=tmt_CheckImg('fileField','100','200','150','250','5','30','jpg|gif ','','');return document.MM_returnValue p input type=file name=fileField /p p input type=submit name=Submit value=Submit /p /form /body /html /snip ~~ Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.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
RE: Checking file size before upload.
Massimo, Try as I might, I can't get your script to work. I've gone through replacing hard carriage returns with spaces where they should be (the message got wrapped), but it's not working, and not throwing any errors with IE5.5. Any chance you could put up a sample form live on the web where we could see it work? Or send it to me w/o linewraps off-list: [EMAIL PROTECTED]? Thanks, Ron -Original Message- From: Massimo Foti [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 25, 2001 3:32 PM To: CF-Talk Subject: Re: Checking file size before upload. Jon Hall [EMAIL PROTECTED] wrote in message news:016501c15d87$53a9a740 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. It's feasible, even if it's quite an hack. It works only on IE and NN 6, no NN 4. It doesn't works on the Mac either (but fails silentely in both cases). I made a Dreamweaver behavior for this, below is a sample code, hope OE will not do bad things with it: html head titleCheck File Upload/title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 script language=JavaScript big snip ~~ Get the mailserver that powers this list at http://www.coolfusion.com 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
Re: Checking file size before upload.
Jon Hall [EMAIL PROTECTED] wrote in message news:022101c15d9b$237615e0 Wow, after staring at the code scratching my head for a few minutes I finally think I get the concept of what you are doing. Basically this is taking the filename and loading the image via a file://url from the local filesystem into a frame and getting all of the relevant data and passing it back to the original page with javascript. This is a really cool idea. Exactely, the idea is not mine, I've got it from a script somewhere, it was crude and simple but cool, so I expanded it much more and adapted the whole beast to make a DW extension out of it. Just a note, I am not using a frame, just creating a new image object passing an url to the new Image constructor. The funny thing is that the url using file:// as pseudoprotocol, so I am pointing to the local file system, that's the core idea, but, again, it's not mine. Without testing the code out, is this not a huge security problem? I'm thinking that as long as the browser is can handle the mime type that it would be possible to grab almost any file from the users hd using the same concept with a few modifications. Well, it may be, but there aren't too many info you can grab from a file this way. For images you can take dimensions and file size... I have no idea if you could grab dangerous info pointing to a text file. Anyway, you still can't upload an arbitrary file from the local file system, but maybe you can raed some info... Since we are posting already huge chuncks of code (I hope people don't mind too much). I developed quite a decent CFML file upload code in the past months. A few details were adapted to make it works better in Ultradev, but I think it may be handy. Using it together with the JavaScript code I posted before you have quite a sophisticated solution. I hope one of these days I will write an article out of it, or maybe a custom tag, in the meantime here it is: !--- If a form containing a field called photo was submitted --- cfif isDefined(form.photo) AND form.file NEQ !--- Check to see if the browser reported a well formed content_length HTTP header --- cfif cgi.content_length EQ cfscript WriteOutPut(Your browser reported a bad formed HTTP header, this could be caused by an error, a bug in your browser or the settings on your Proxy/Firewall); /cfscript !--- Abort processing --- cfabort /cfif !--- Set max size allowed in KB--- cfset tmtMaxSizeKB=10 !--- Convert the value in byte --- cfset tmtMaxSize=#Evaluate(tmtMaxSizeKB*1024)# !--- Check for file size as reported by the HTTP header--- cfif Val(cgi.content_length) GT tmtMaxSize !--- Use cfscript to write an error, to avoid UD display bad things if the code is written above the body tag --- cfscript WriteOutPut(The selected file's size is greater than the #tmtMaxSizeKB# KiloBytes maximum size allowed, please select another one and try again.); /cfscript !--- Abort processing --- cfabort /cfif !--- Upload the file, make unique names on clashes and allow only images --- cftry cffile action=upload filefield=photo destination=#ExpandPath(images)# nameconflict=makeunique accept=image/* !--- If the file upload failed --- cfcatch type=Any !--- Display errors --- cfscript WriteOutPut(An error occurred during the file upload process.brbr); WriteOutPut(This is likely due to one of the reasons below:brbr); WriteOutPut(1) The MIME type of the uploaded file was not accepted by the server. Please verify that you are uploading a file of the appropriate type.br); WriteOutPut(2) The application doesn't have the correct permissions on the server.brbr); WriteOutPut(If the problem persist, please contact the website's administrator.); /cfscript !--- Abort processing --- cfabort /cfcatch /cftry !--- if the file was saved --- cfif isDefined(file.FileWasSaved) !--- To be sure, check the file size again, just in case the HTTP header was faked --- cfif file.FileSize GT tmtMaxSize cfset tmtServerFilePath=file.ServerDirectory\file.ServerFile !--- Be sure the file exist before we delete it --- cfif FileExists(tmtServerFilePath) cftry !--- Delete the beast --- cffile action=delete file=#tmtServerFilePath# !--- Display error, it's a different message than before, good to catch the difference for debugging --- cfscript WriteOutPut(The uploaded file's size is greater than the #tmtMaxSizeKB# KiloBytes maximum size allowed, please select another one and try again.); /cfscript !--- Abort processing --- cfabort cfcatch type=Any !--- Something went wrong on deleting, display error --- cfscript WriteOutPut(An error occurred during the file upload process); /cfscript !--- Abort processing --- cfabort /cfcatch /cftry /cfif /cfif !--- Store the name of the file inside the form variable --- cfset form.photo=file.ServerFile !--- Redirect if needed --- cfset
RE: Checking file size before upload.
Ditto -Original Message- From: Ron Hornbaker [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 25, 2001 2:50 PM To: CF-Talk Subject: RE: Checking file size before upload. Massimo, Try as I might, I can't get your script to work. I've gone through replacing hard carriage returns with spaces where they should be (the message got wrapped), but it's not working, and not throwing any errors with IE5.5. Any chance you could put up a sample form live on the web where we could see it work? Or send it to me w/o linewraps off-list: [EMAIL PROTECTED]? Thanks, Ron -Original Message- From: Massimo Foti [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 25, 2001 3:32 PM To: CF-Talk Subject: Re: Checking file size before upload. Jon Hall [EMAIL PROTECTED] wrote in message news:016501c15d87$53a9a740 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. It's feasible, even if it's quite an hack. It works only on IE and NN 6, no NN 4. It doesn't works on the Mac either (but fails silentely in both cases). I made a Dreamweaver behavior for this, below is a sample code, hope OE will not do bad things with it: html head titleCheck File Upload/title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 script language=JavaScript big snip ~~ Get the mailserver that powers this list at http://www.coolfusion.com 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
Re: Checking file size before upload.
Ron Hornbaker [EMAIL PROTECTED] wrote in message Try as I might, I can't get your script to work. I've gone through replacing hard carriage returns with spaces where they should be (the message got wrapped), but it's not working, and not throwing any errors with IE5.5. Any chance you could put up a sample form live on the web where we could see it work? Or send it to me w/o linewraps off-list: [EMAIL PROTECTED]? Here it is: http://www.massimocorner.com/beta/js_upload.htm You can try it on-line or download it, rename it with a .cfm extension and see the whole beast in action. I added a few lines of CFML code that will show you the value of the form fields. I did this because there is an additional feature I didn't talk about before. The script can read the dimensions of an image (in pixels) and store them in two hidden fields, this way you can insert them in a db. I think it's pretty slick :-) Hope you will like it and you really make me think it's time to write an article about it... Massimo Foti [EMAIL PROTECTED] http://www.massimocorner.com Dreamweaver, Ultradev and Fireworks goodies http://www.projectseven.com/viewer/snippets.htm Snippets Panel ~~ Get the mailserver that powers this list at http://www.coolfusion.com 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
Re: Checking file size before upload.
Well, is this thing just too cool or what? Works like a charm. Thanks, Massimo! Any compatibility issues with regard to browsers and the js used? --- Matt Robertson[EMAIL PROTECTED] MSB Designs, Inc., www.mysecretbase.com --- -- Original Message -- from: Massimo Foti [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] date: Fri, 26 Oct 2001 00:18:02 +0200 Ron Hornbaker [EMAIL PROTECTED] wrote in message Try as I might, I can't get your script to work. I've gone through replacing hard carriage returns with spaces where they should be (the message got wrapped), but it's not working, and not throwing any errors with IE5.5. Any chance you could put up a sample form live on the web where we could see it work? Or send it to me w/o linewraps off-list: [EMAIL PROTECTED]? Here it is: http://www.massimocorner.com/beta/js_upload.htm You can try it on-line or download it, rename it with a .cfm extension and see the whole beast in action. I added a few lines of CFML code that will show you the value of the form fields. I did this because there is an additional feature I didn't talk about before. The script can read the dimensions of an image (in pixels) and store them in two hidden fields, this way you can insert them in a db. I think it's pretty slick :-) Hope you will like it and you really make me think it's time to write an article about it... Massimo Foti [EMAIL PROTECTED] http://www.massimocorner.com Dreamweaver, Ultradev and Fireworks goodies http://www.projectseven.com/viewer/snippets.htm Snippets Panel ~~ Get the mailserver that powers this list at http://www.coolfusion.com 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
Re: Checking file size before upload.
Matt Robertson [EMAIL PROTECTED] wrote in message Well, is this thing just too cool or what? Works like a charm. Thanks, Massimo! Any compatibility issues with regard to browsers and the js used? No NN 4 and no Mac browsers, but it fails silentely on both cases. The reason why it fails on the Mac is that on the file field on Mac OS you will see just the name of the file, not the full path. Glad to see you liked it :-) Massimo Foti [EMAIL PROTECTED] http://www.massimocorner.com Dreamweaver, Ultradev and Fireworks goodies http://www.projectseven.com/viewer/snippets.htm Snippets Panel ~~ Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.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
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 ~~ Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.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
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 ~~ Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.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
Re: Checking file size before upload.
Lon Lentz [EMAIL PROTECTED] wrote in message Is there a way to check the size of a file before the server CFFile-Uploads it? Something like this should help you getting started: cfif isDefined(form.photo) cfset tmtFileSize=5 cfif Val(cgi.content_length) GT tmtFileSize cfscript WriteOutPut(The selected file's size is greater than the #tmtFileSize# bytes maximun size allowed, please select another one and try again.); /cfscript cfabort /cfif cffile action=upload filefield=photo destination=#ExpandPath(../myfolder)# nameconflict=makeunique accept=image/* /cfif -- Massimo Foti [EMAIL PROTECTED] http://www.massimocorner.com Dreamweaver, Ultradev and Fireworks goodies http://www.projectseven.com/viewer/snippets.htm Snippets Panel ~~ Get the mailserver that powers this list at http://www.coolfusion.com 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