Solved

Why is my user image cffile uploads not working?

Posted on 2008-10-25
3
445 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Does Your Cloud Backup Use Blockchain Technology?

Blockchain technology has already revolutionized finance thanks to Bitcoin. Now it's disrupting other areas, including the realm of data protection. Learn how blockchain is now being used to authenticate backup files and keep them safe from hackers.

Question has a verified solution.

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

Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

627 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