在文件上传时,Coldfusion返回:C:\ ColdFusion8\runtime\servers\coldfusion\SERVER-INF\temp\wwwroot-tmp \neotmp12429.tmp不包含文件

Dan*_*sen 1 coldfusion cffile cfinput

在文件上传时,Coldfusion 8返回:C:\ ColdFusion8\runtime\servers\coldfusion\SERVER-INF\temp\wwwroot-tmp \neotmp12429.tmp不包含文件.有谁知道可能导致这种情况的原因?语法不好?服务器权限?遗失了什么?

我的cfform标签如下所示:

<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>
Run Code Online (Sandbox Code Playgroud)

Dan*_*sen 9

我解决了这个问题,它很微妙,但容易被忽视.

cffile标记的fileField属性只是询问文件输入的名称,而不是生成的Coldfusion FORM变量.

错误:

<cffile action="upload" fileField="#form.myImage#" ...
Run Code Online (Sandbox Code Playgroud)

对:

<cffile action="upload" fileField="myImage" ...
Run Code Online (Sandbox Code Playgroud)