文件上传时,Coldfusion 返回: C:\ColdFusion8\runtime\servers\coldfusion\SERVER-INF\temp\wwwroot-tmp\neotmp12429.tmp 不包含文件
文件上传后,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>
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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我解决了这个问题,它很微妙,但很容易被忽视。
cffile 标记的 fileField 属性只是询问文件输入的名称,而不是生成的 Coldfusion FORM 变量。
错误:
正确:
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:
Right:
上面的答案是正确的,但只是想补充一下,以防有人我已经解决了我的相关问题。
我原来的图片上传代码是这样的;
这导致了标题中提到的类似错误(C:\ColdFusion8\runtime\servers\coldfusion\SERVER-INF\temp\wwwroot-tmp\neotmp12429.tmp)。
当我将代码更改为;
一切都很帅!老实说,我不知道为什么,但只是需要注意一下。
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;
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;
All was hunky dorey! To be honest I don't know why but just something to look out for.