> I would like to trap a CFFILE error using CFTRY/CFCATCH if 
> the user submits a bad file type. I only want to allow them 
> to upload .gif files.
> 
> I can use the CFCATCH TYPE="Any" to trap it, but I was hoping 
> that I could trap specifically for a bad file type.
> 
> I noticed that there are a whole slew of "advanced" exception 
> types starting with COM.* listed in the documentation, but I 
> can't find one for a bad file type.
> 
> Can one of those advanced types or a regular type be used 
> other than "Any"?

I have no idea, but it should be very easy to find out:

<cftry>

        <cffile upload...>

        <cfcatch>
                <cfoutput>#CFCATCH.Type#</cfoutput>
        </cfcatch>

</cftry>

You should be able to run this in your upload action page, and see what
happens if you specify the wrong file type. My guess is that CFFILE will
fail silently (not generating an exception), but you should be able to
simply look at FILE.FileWasUploaded or whatever the appropriate File
variable is instead.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444
______________________________________________________________________
Get Your Own Dedicated Windows 2000 Server
  PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation · $99/Month · Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionb
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

Reply via email to