Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Weird cffile issue [on MAC/IE]

Status
Not open for further replies.

dallasweb

Programmer
Jan 4, 2001
45
US
I have an issue with cffile on OS MAC using IE.

If the file field is left blank it passes a .tmp file in the form fields and this makes the cffile tag blow up because I'm limiting acceptable file type to jpg or gif.

My code works fine in all other OS and browsers.

<CFIF Trim(uploadfile) IS NOT &quot;&quot;>
<!--- upload the new file --->
<cffile action=&quot;UPLOAD&quot;
filefield=&quot;uploadfile&quot;
destination=&quot;#request.imageroot#&quot;
nameconflict=&quot;MAKEUNIQUE&quot;
accept=&quot;image/jpeg, image/jpg, image/gif, image/pjpeg&quot;>
<CFSET article_image = '#File.ServerFile#'>
<CFELSE>
<CFSET article_image = 0>
</CFIF>

Is there a way to check for file type before the cffile tag?

Any input is appreciated.

 
Instead of testing &quot;uploadfile&quot; to see if it is blank, instead check it for the existence of the string &quot;.tmp&quot;:

<CFIF Trim(uploadfile) DOES NOT CONTAIN &quot;.tmp&quot;>
<!--- upload the new file --->
<cffile action=&quot;UPLOAD&quot;
filefield=&quot;uploadfile&quot;
destination=&quot;#request.imageroot#&quot;
nameconflict=&quot;MAKEUNIQUE&quot;
accept=&quot;image/jpeg, image/jpg, image/gif, image/pjpeg&quot;>
<CFSET article_image = '#File.ServerFile#'>
<CFELSE>
<CFSET article_image = 0>
</CFIF>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top