Why is my user image cffile uploads not working?

I'm using cffile for users to upload images. All seems to go fine when I test but there is never any image in the destination directory, which does exist. No errors.

FYI, I will want to limit the file size and possibly resize the image if too large.

Is there a better way to do this using CF8?
<cfif isdefined("form.iupload") and len(form.myImage)>
 
<cfset myFileName = "">
 
<cffile action="upload"
      destination="C:\ColdFusion8\wwwroot\baker\user_content\"
      nameconflict="makeunique"
      filefield="myImage"
      accept="image/jpg,image/gif">
<cfset myFileName = cffile.serverFile>
      
<cfoutput>
The file Uploaded was #myFileName#
</cfoutput>
 
</cfif> 
 
<form name="iupload" action="send.cfm" method="post" enctype="multipart/form-data">
  Upload image: <input type="file" name="myImage"> <input type="submit" value="Upload">
</form>

Open in new window

JanrowAsked:
Who is Participating?
 
ZvonkoConnect With a Mentor Systems architectCommented:
Also add jpeg to mime types:
accept="image/jpg,image/jpeg,image/gif">

Open in new window

0
 
ZvonkoSystems architectCommented:
Change your cfif statement to this:
<cfif isdefined("form.myImage") and len(form.myImage)>

Open in new window

0
 
JanrowAuthor Commented:
That seems to have done it! Thanks!
0
All Courses

From novice to tech pro — start learning today.