我的代码获取上传的文件,调整其大小并尝试将其保存到另一个文件,从临时文件夹到目标文件夹。我已经尝试了在线找到的示例代码的所有变体。当 cfimage 标签去保存调整大小的图像时,文件从原始位置消失。然后抛出这个错误:
d:\temp\imageUploads\HeadshotsampleRDB.jpg (The system cannot find the file specified)
如果我将目的地更改为最终位置,原始文件会重新出现!
<cffile
accept="image/gif, image/jpeg, image/jpg, image/pjpeg, image/png, image/xpng, image/x-png"
action="upload"
nameconflict="makeunique"
filefield="newphoto"
destination="d:\temp\imageUploads">
<cfset destFileName = session.Lastname & "_" & CreateUUID() & "." & cffile.serverFileExt>
<cfimage action="info" source="d:\temp\imageUploads\#cffile.serverfile#" structname="info">
<cfif info.width GT 100 OR info.height GT 150>
<cfif info.width GT 100>
<cfset lawyerImage=ImageNew("d:\temp\imageUploads\#cffile.serverfile#")>
<cfset ImageResize(lawyerImage,"100","","highestPerformance",1)>
<cfimage action="write" source="#lawyerImage#" destination="d:\temp\imageUploads\#cffile.serverfile#" overwrite="yes">
<cfelse>
<cfset lawyerImage=ImageNew("d:\temp\imageUploads\#cffile.serverfile#")>
<cfset ImageResize(lawyerImage,"","150","highestPerformance",1)>
<cfimage action="write" source="#lawyerImage#" destination="d:\temp\imageUploads\#cffile.serverfile#" overwrite="yes">
</cfif>
</cfif>
<cffile action="rename"
source="d:\temp\imageUploads\#cffile.serverfile#"
destination="#imgsPath#\photos\#destFileName#">
我可以发誓我安装了热修复 4,我看到了文件,但 CF 管理员只向我们显示热修复级别 2。