我的代码获取上传的文件,调整大小并尝试将其保存到另一个文件,从临时文件夹到目标文件夹。我已经尝试了在线找到的所有示例代码变体。当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显示我们。