Unfortunately, I was trying to detect if somebody had, for instance, simply
renamed a text (.txt) file to .jpg - Wondered if there was something - maybe
in the file - that would give me the true "type".

-----Original Message-----
From: Dave l [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 07, 2007 5:53 PM
To: CF-Talk
Subject: Re: MIME type


if you were on cfm 6 you could probably check via java, if you were on 8 i
think it will tell u.

but since you are on pre-civil war version it would probably be harder.

Quick n dirty you could grab the file and look at last 3 letters and tell
and if they are ok let them through, if not error

like

<cfscript>
   thefile = theimage.jpg;
   checkFile = right(thefile, 3);
</cfscript>

<cfif checkFile eq "jpg">
ok let it through
<cfelseif checkFile eq "gif">
ok let it through
<cfelse>
not acceptable image format
</cfif>




>Hi,
>    CF5.0
>    I have a <CFFILE action="upload" accept="image/*"
>nameconflict="Overwrite" destination="..."> (wrapped in a <cftry><cfcatch>)
>that is failing. Permissions are fine, so as a first step I'm assumimg it's
>the MIME type problem.  How do I determine the actual MIME type of a file
>that user's are trying to upload?
>
>    Thanks in advance
>
>    Dave



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Get involved in the latest ColdFusion discussions, product
development sharing, and articles on the Adobe Labs wiki.
http://labs/adobe.com/wiki/index.php/ColdFusion_8

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:292940
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