Hi, What I did is do both client and server side validations.
The client side check is put all the accepted file extension in a list then use a JavaScript to validate the file field at the submission. If the user uploaded an unaccepted file display alert message do not submit the form. The server side validation I did more than just use the attributes in the CFFile tag. After the uploading I actually check the extension of the server file again because some MIME type let go not only one type of the file. If the uploaded file is unacceptable I will deleted it straight away. Also using cftry and cfcatch is not enough, if the use upload an empty file the cfcatch will not catch it, but the CFFILE.ServerFile is not created, when you try to reference it you will get an error. (This was caught by our QA guy!). If you need some JavaScript for this please let me know I will send you directly. Hope this helps. Sima -----Original Message----- From: Scott Wolf [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 28, 2003 6:01 PM To: CF-Talk Subject: Re: CFFILE Upload question Actually.....let me be more specific. I tried it and it gives a CF error message. What can I do to avoid that? I just want to redirect the user back to the upload form and have a message display at the top saying something like "Uploading this file type is not allowed. You may only upload images and audio clips." That's where I really need the help. (or was that response supposed to be some sort of CFTRY pun? :P ) Scott ----- Original Message ----- From: "Bryan Love" <[EMAIL PROTECTED]> To: "CF-Talk" <[EMAIL PROTECTED]> Sent: Wednesday, May 28, 2003 5:36 PM Subject: RE: CFFILE Upload question > try it and see :) > > +-----------------------------------------------+ > Bryan Love > Database Analyst > Macromedia Certified Professional > Internet Application Developer > TeleCommunication Systems > [EMAIL PROTECTED] > +-----------------------------------------------+ > > "...'If there must be trouble, let it be in my day, that my child may have > peace'..." > - Thomas Paine, The American Crisis > > "Let's Roll" > - Todd Beamer, Flight 93 > > > > -----Original Message----- > From: Scott Wolf [mailto:[EMAIL PROTECTED] > Sent: Wednesday, May 28, 2003 2:14 PM > To: CF-Talk > Subject: CFFILE Upload question > > > If I specify MIME types in the ACCEPT attribute such as: > > <CFFILE ACTION="UPLOAD" FILEFIELD="Form.Upload1" > DESTINATION="C:\Inetpub\wwwroot\imghost\#SecureCheck.txtUserName#" > NAMECONFLICT="MAKEUNIQUE" ACCEPT="text/html"> > > What happens if someone tries to upload a file that isn't on the "accept" > list (like a jpg)? Does a CF error page display? I'm new to working with > CFFILE and I'm not even sure if I'm asking the right question. Any help > would be greatly appreciated. Thanks! > > Scott Wolf > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. http://www.cfhosting.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

