我有一个接受用户图片的页面,重命名它们并返回新文件名以供进一步处理
<cffunction name="uploadfile" access="public" returntype="string">
<!--- TODO files should not be uploaded to web accesible directories - use #GetTempDirectory()# to use the temporary directory--->
<cfargument name="forma" type="struct" required="yes">
<cfargument name="db" type="string" required="yes">
<cfargument name="user_id" type="string" required="yes">
<cfparam name="new_filename" default="">
<cfset mediapath = expandpath('/ugc_images/images')>
<cfset thumbpath = expandpath('/ugc_images/images/thumbs')>
<cfif structKeyExists(forma,"fileUpload") and len(forma.fileUpload)>
<cffile action="upload" filefield="FileUpload" destination="#MediaPath#" nameconflict="makeunique" accept="image/jpeg,image/gif,image/png">
<!---<cfset serverfile.extension = right(file.serverFile, 3)> --->
<cfset new_filename= "#user_id#_#DateFormat(Now(), "mm-dd-yyyy")#.jpg">
<cffile action="rename" source="#MediaPath#/#file.serverFile#" destination="#MediaPath#/#new_filename#"/>
<cfimage source="#MediaPath#/#new_filename#" name="myImage">
<cfset ImageSetAntialiasing(myImage,"on")>
<cfif myImage.width gt 1000 or myImage.height gt 1000><cfset ImageScaleToFit(myImage,1000,1000)> </cfif>
<cfset ImageWrite(myImage,"#MediaPath#/#new_filename#")>
<cfif myImage.width gt 300 or myImage.height gt 300><cfset ImageScaleToFit(myImage,300,300)></cfif>
<cfset ImageWrite(myImage,"#thumbpath#/#new_filename#")>
</cfif>
<cfreturn "#new_filename#">
</cffunction><!---EO uploadfile--->
在调用该函数之后(确实上传并保存了文件及其缩略图,所有的coldfusion功能似乎都挂了。网络服务器仍然提供纯文本,但任何coldfusion标签无论多么简单,超时 例如,在上述之后我有了这个:
This text is served to the browser
<hr>
and this
<hr>
<cfoutput >but this times out</cfoutput>
and it never gets here
<hr>
这一切在我的本地计算机上运行良好,但在远程(生产)服务器上它崩溃了。它位于共享主机上,因此我对设置的访问权限有限
知道发生了什么事吗?