1

Upon file upload, Coldfusion 8 returns: C:\ColdFusion8\runtime\servers\coldfusion\SERVER-INF\temp\wwwroot-tmp\neotmp12429.tmp did not contain a file. Does anyone know what may cause this? Bad syntax? Server permissions? Missing pieces?

My cfform tag looks like the following:

<cfset myPath = "path to my folder">
<cfset mimeTypesList = "list of mime types I can accept">

<cfif structKeyExists(FORM, "submit")>
    <cffile action="upload" fileField="#form.myImage#" destination="#myPath#"
accept="#mimeTypesList#" nameConflict="MakeUnique">
</cfif>

<cfform name="myForm" format="html" action="#cgi.SCRIPT_NAME#" method="post" enctype="multipart/form-data">
<cfinput type="file" name="myImage" accept="image/jpg,image/gif,image/pjpeg">
<cfinput type="submit" name="submit" value="submit">
</cfform>
Dan Sorensen
  • 11,403
  • 19
  • 67
  • 100
  • Does it happen all the time? Or just occasionally? – Sam Farmer Dec 09 '09 at 01:00
  • Sam: In this instance it happened every single time. But I've used cffile a lot and almost never run into this issue. As you see from the solution I figured out below, it was a case of me making a mistake and Coldfusion having terrible error reporting in this particular case. – Dan Sorensen Dec 09 '09 at 17:34
  • I have used a similar approach, and have noticed the same issue, however it has been intermittent. – Ahmad Feb 16 '10 at 20:12

2 Answers2

9

I solved the problem, it's subtle, but easy to overlook.

The cffile tag's fileField attribute is simply asking for the name of the file input, NOT the resulting Coldfusion FORM variable.

Wrong:

<cffile action="upload" fileField="#form.myImage#" ...

Right:

<cffile action="upload" fileField="myImage" ...
Dan Sorensen
  • 11,403
  • 19
  • 67
  • 100
0

The answer above is correct but just wanted to add to it in case anyone my related issue which I have resolved.

My original image upload code was like this;

<cfobject component="#session.components#files" name="files">
<cfset url_file_path = files.uploadImage(file_upload)>

This caused a similar error mentioned in the title (C:\ColdFusion8\runtime\servers\coldfusion\SERVER-INF\temp\wwwroot-tmp\neotmp12429.tmp).

When I changed my code to;

<cfinvoke component="#session.components#files"
method="uploadImage"
formField = "file_upload" 
returnvariable = "url_file_path">

All was hunky dorey! To be honest I don't know why but just something to look out for.

IanOSullivan
  • 549
  • 1
  • 4
  • 12