views:

339

answers:

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>
+6  A: 

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