经过一些研究后,我觉得这应该可行,但是它没有将文件保存到我的图像目录中。
<cfform name="uploadImgForm" method="post" action="#CGI.PATH_INFO#?#CGI.QUERY_STRING#" enctype="multipart/form-data">
<input name="txtImg" type="file" />
<input name="btnSubmit" type="submit" />
</cfform>
<cfif isDefined("Form.txtImg")>
<cffile action="upload"
fileField = "txtImg"
destination="/Images"
accept="image/jpeg"
nameconflict="makeunique">
</cfif>
我计划进行一些验证,但我想首先让这个简单的示例正常工作。
我后来遇到了这个,这在上传之前尝试重命名文件时很有帮助:Adobe 链接 http://blogs.adobe.com/cantrell/archives/2004/07/renaming_files.html
目标必须是完整路径,否则它将被发送到相对于 ColdFusion 临时目录的目录。
尝试这个:
<cfset destination = expandPath("Images") />
<cffile action="upload"
fileField = "txtImg"
destination="#destination#"
accept="image/jpeg"
nameconflict="makeunique">
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)