【发布时间】:2014-12-03 23:53:20
【问题描述】:
我正在尝试使用此代码将文件上传到我的服务器,但出现错误。
这是代码:
<cfif isdefined("form.submit")>
<cffile action="uploadall" destination="#expandpath('../../images/Uploads/after')#">
</cfif>
<cfform action="#cgi.script_name#" enctype="multipart/form-data">
<cfinput type="file" name="attachment1"><br>
<cfinput type="file" name="attachment2"><br>
<cfinput type="file" name="attachment3"><br>
<cfinput type="submit" name=" submit" value="submit">
</cfform>
这是错误:
以下信息仅供网站开发人员用于调试目的。
处理请求时发生错误
无效的内容类型:application/x-www-form-urlencoded。
文件上传动作要求表单使用 enctype="multipart/form-data"。
错误发生在 E:\sites\Example.Com\testing\handlers\upload\after.cfm: line 20
【问题讨论】:
-
您运行的是 CF9 还是 9.0.1? CF9 原始版本中的文件上传控件存在许多问题,这些问题已在 9.0.1 更新程序中得到修复。