> Will this work?
> <cffile action="upload" destnation="c:\temp".... accept="GIF,JPG">
> I did try it but again it was allowing file of any type to be
> uploaded.

You have to specify the MIME types exactly. You might want to get a list of
MIME types, if you don't already know them. I've included a sample file,
which will submit a file to itself if it's a GIF or JPEG. The MIME type for
a GIF is "image/gif", not  "images/gif". In addition, CFFILE will throw an
error if you send the wrong MIME type in CF 4.5.1.

<!--- uploadme.cfm --->

<CFIF IsDefined("Form.myaction")>

        <CFTRY>

                <CFFILE ACTION="UPLOAD"
          FILEFIELD="myfile"
          DESTINATION="C:\Inetpub\wwwroot\test\cffile"
                NAMECONFLICT="OVERWRITE"
          ACCEPT="image/gif,image/jpeg,image/pjpeg">

                <CFCATCH>
                Wrong file type!
                </CFCATCH>

        </CFTRY>

</CFIF>

<html>
<head>
        <title>file upload filter</title>
</head>

<body>

<form action="uploadme.cfm" method="post" enctype="multipart/form-data">
<input type="file" name="myfile">
<input type="submit" name="myaction">
</form>

</body>
</html>
<!--- end uploadme.cfm --->

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444

------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to