Solved

Why is my user image cffile uploads not working?

Posted on 2008-10-25
3
441 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 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
I am trying to set a time variable based on the current time with ColdFusion 7 65
CFFILE upload help 98 138
Webserver access problem 5 68
ColdFusion 10 Error 2 36
Today, I was working on some optimization and spam-stopping techniques when I encountered Ben Nadel's post to reduce spam feature using Math (http://www.bennadel.com/blog/197-How-I-Stop-Spammers-On-My-ColdFusion-Blog.htm). While this method is not o…
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

911 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now