On file upload, Coldfusion returns: C:\ColdFusion8\runtime\servers\coldfusion\SERVER-INF\temp\wwwroot-tmp\neotmp12429.tmp did not contain a file

StackOverflow https://stackoverflow.com/questions/1870943

  •  18-09-2019
  •  | 
  •  

Question

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>
Was it helpful?

Solution

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" ...

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top