Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Why is my user image cffile uploads not working?

Posted on 2008-10-25
3
Medium Priority
?
447 Views
Last Modified: 2013-12-24
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

0
Comment
Question by:Janrow
  • 2
3 Comments
 
LVL 63

Expert Comment

by:Zvonko
ID: 22804936
Change your cfif statement to this:
<cfif isdefined("form.myImage") and len(form.myImage)>

Open in new window

0
 
LVL 63

Accepted Solution

by:
Zvonko earned 2000 total points
ID: 22804938
Also add jpeg to mime types:
accept="image/jpg,image/jpeg,image/gif">

Open in new window

0
 

Author Closing Comment

by:Janrow
ID: 31510002
That seems to have done it! Thanks!
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi, I will be creating today a basic tutorial on how we can create a Mail Custom Function and use it where ever we want. The main advantage about creating a custom function is that we can accommodate a range of arguments to pass to the Function and …
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

926 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question