How about using CFCATCH and CFTRY in your application?
<cftry>

    <cffile action="UPLOAD" filefield="FileFildName
destination="FileServerPath\" nameconflict="MAKEUNIQUE" accept="image/gif">
   <cfcatch type="Any">
   <cfset ErrMsg = 'You have entered an invalid file type. The only allowed
file types are .jpg and .gif'>
   </cfcatch>
   </cftry>
   <cfif LEN('ErrMsg')>
    <cfoutput>
   #ErrMsg#
  <cfabort>
  </cfoutput>
   </cfif>

----- Original Message -----
From: "W Luke" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Saturday, February 09, 2002 3:00 PM
Subject: Detecting file-types on upload


> If I use the Accept attribute of cffile (ACCEPT="image/gif,image/pjpeg")
to
> accept *just* GIFs and JPEGs, and a user uploads say a bitmap, how can I
> leave them a custom-error rather than the CF-produced error?  I need to do
a
> <Cfif> loop on file.serverfile, but I've not dealt with file-types before
>
> I'd appreciate any help
>
> Thanks
>
> Will
> ---
> "A woman drove me to drink and I didn't even have the decency to thank
> her." --W.C. Fields
>
> 
______________________________________________________________________
Why Share?
  Dedicated Win 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=coldfusionc
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