Not quite sure what's happening here on the user end...

Does the user have to specify an "Upload Type" for
the CFSwitch Expression variable?  Then the validation
is run against their choice and the file they are attempting
to upload?



Rick

-----Original Message-----
From: Martyn Bowis [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 24, 2006 8:21 PM
To: CF-Talk
Subject: RE: Mime Type for File Upload

Hi Rick,

The following is a list of mime types:

http://www.netdesign.co.nz/mime.htm

I suggest that you use a cfswitch to validate your file uploads (see below).
You could also add another switch that evaluates mime type ... Which I
assume you are already doing, hence the need for the list.

Kind regards,
Martyn

<cfswitch expression="#UploadType#" >

        <cfcase value="Image" ><cfset lst_Extensions = "gif,jpg" ></cfcase>
        <cfcase value="Flash" ><cfset lst_Extensions = "swf" ></cfcase>
        <cfcase value="PDF" ><cfset lst_Extensions = "pdf" ></cfcase>
        <cfcase value="Movie" ><cfset lst_Extensions =
"mpg,mpeg,avi,mov,rm,ra,ram" ></cfcase>
        <cfcase value="Audio" ><cfset lst_Extensions = "mp3,wav" ></cfcase>
        <cfcase value="Zip" ><cfset lst_Extensions = "zip" ></cfcase>
        <cfcase value="File" ><cfset lst_Extensions = "csv,txt,xls,doc"
></cfcase>
        <cfcase value="MSWord" ><cfset lst_Extensions = "doc" ></cfcase>
        <cfcase value="MSExcel" ><cfset lst_Extensions = "csv,xls"
></cfcase>
        <cfcase value="MSPowerpoint" ><cfset lst_Extensions = "ppt"
></cfcase>
        <cfcase value="MSAccess" ><cfset lst_Extensions = "mdb" ></cfcase>
        <cfcase value="StyleSheet" ><cfset lst_Extensions = "css" ></cfcase>
        <cfcase value="FlashVideo" ><cfset lst_Extensions = "flv" ></cfcase>
        <cfdefaultcase><cfset lst_Extensions = "gif,jpg" ></cfdefaultcase>

</cfswitch>

<cfif ListFindNoCase(lst_Extensions,extension) >
        <cfset valid = true >
<cfelse>
        <cfset valid = false >
</cfif>

<cfif valid EQ true >
        <!--- process --->
<cfelse>
        <!--- error --->
</cfif>



 

-----Original Message-----
From: Rick Faircloth [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 25, 2006 12:50 PM
To: CF-Talk
Subject: Mime Type for File Upload

Need to specify the CFFILE "Accept" attributes for .doc and .pdf.

What would those be?

I know Accept  = "application/msword" would accept Word docs, but would they
be limited .doc filetype?

And what about .pdf. application or text or ???

I want to limit uploads to .doc and .pdf only.

Thanks,

Rick







~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:257946
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to