3 Replies Latest reply on Jul 18, 2006 7:06 PM by dlasley

    I cannot upload image to my Linux  server

    chinaeye
      Hi,Friend,
      Now I launched my adsbus.com for global chinese community.

      before we are running on windows, ok. but now in red hat linux, we cannot upload the image: the error message:


      The web site you are accessing has experienced an unexpected error.
      Please contact the website administrator.

      The following information is meant for the website developer for debugging purposes.

      Error Occurred While Processing Request
      Unable to create temporary file


      The error occurred in /vservers/adsbusco/htdocs/home/Application.cfm: line 5

      3 : <!--- Set encoding to UTF-8. --->
      4 : <cfset setEncoding("URL", "UTF-8")>
      5 : <cfset setEncoding("Form", "UTF-8")>
      6 :
      7 : <cfparam name="url.login" default="">



      --------------------------------------------------------------------------------

      Resources:
      Check the ColdFusion documentation to verify that you are using the correct syntax.
      Search the Knowledge Base to find a solution to your problem.


      Browser Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; Alexa Toolbar)
      Remote Address 202.156.6.51
      Referrer http://www.adsbus.com/home/uploadfile.cfm
      Date/Time 17-Jul-06 11:24 AM

      Stack Trace (click to expand)
      at cfApplication2ecfm1374464217.runPage(/vservers/adsbusco/htdocs/home/Application.cfm:5)


      java.lang.SecurityException: Unable to create temporary file
      at java.io.File.checkAndCreate(Unknown Source)
      at java.io.File.createTempFile(Unknown Source)
      at coldfusion.filter.FormScope.fillForm(FormScope.java:159)
      at coldfusion.filter.FormScope.setEncoding(FormScope.java:42)
      at coldfusion.runtime.CFPage.SetEncoding(CFPage.java:886)
      at cfApplication2ecfm1374464217.runPage(/vservers/adsbusco/htdocs/home/Application.cfm:5)
      at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:152)
      at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:349)
      at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
      at coldfusion.filter.CfincludeFilter.include(CfincludeFilter.java:33)
      at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:157)
      at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:51)
      at coldfusion.filter.PathFilter.invoke(PathFilter.java:86)
      at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:69)
      at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:2 8)
      at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
      at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
      at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
      at coldfusion.filter.RequestThrottleFilter.invoke(RequestThrottleFilter.java:115)
      at coldfusion.CfmServlet.service(CfmServlet.java:107)
      at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:78)
      at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
      at com.seefusion.Filter.doFilter(Filter.java:49)
      at com.seefusion.SeeFusion.doFilter(SeeFusion.java:1300)
      at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
      at jrun.servlet.FilterChain.service(FilterChain.java:101)
      at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
      at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
      at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:257)
      at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:541)
      at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:204)
      at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:318)
      at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:426)
      at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:264)
      at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)



        • 1. I cannot upload image to my Linux  server
          chinaeye Level 1
          this is the upload.cfm to upload image to linux server.
          thanks for all of you to help.

          <html>
          <head>
          <link href="../css/cpfcom.css" rel="stylesheet" type="text/css">
          </head>
          <body>
          <cfif isdefined("URL.delete")>
          <cffile action="delete" file="#expandpath("uploadfile\")##session.n#">
          <cflock timeout=5 scope="Session" type="Exclusive">
          <cfset StructDelete(Session, "n")>
          </cflock>
          </cfif>

          <cfquery datasource="adsbusco" name="conf">
          select sctp,daxiao,scclose, posting_no from config
          </cfquery>
          <cfif #conf.recordcount# neq 0>
          <cfset noofposting=#conf.posting_no#>
          <cfelse>
          <cfset noofposting=5>
          </cfif>
          <cfif #conf.scclose# is 1>用户上传图片已关闭<cfabort></cfif>
          <cfif not isdefined("cookie.sctps")><cfelseif #cookie.sctps# gt #conf.sctp#><font face="arial" class="fixed">exceed the limitation,thanks。</font><cfabort></cfif>
          <cfif not isdefined("url.action")>
          <form action="uploadfile.cfm?action=ok" method="post" enctype="multipart/form-data" name="cform">
          <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
          <td><input name="file" type="file"> <font face="arial" class="fixed">  
          <input type="submit" name="Submit" value="Upload" >
          <cfoutput>one ads one image.<!--- (已上传<cfif not isdefined("cookie.sctps")>0<cfelse>#cookie.sctps#</cfif>个,今天可以上传#conf.sctp#个图片) ---></cfoutput></font>
          </table>
          </form>
          <cfelseif #url.action# is "ok">
          <cftry>
          <cfif #form.file# is not "">

          <cffile action=upload destination="#expandpath("uploadfile\")#"
          nameconflict="makeunique" filefield="form.file" accept="image/*">
          <!--上面的accept可以改成你所想要的类型.如果只想上传图片的话,image/*就可以了.-->
          <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
          <td><font face="arial" class="fixed"><cfif cffile.filesize gt #conf.daxiao#>
          <cffile action="delete" file="#expandpath("uploadfile\")##cffile.serverFile#">文件太大了(允许100K以下)<a href="javascript:history.back();">继续上传</a></font>
          <cfelse><cfoutput>
          <!---下面把上传图片个数检测--->
          <cfset times="#CreateTimeSpan(1, 0, 0, 0)#">
          <cfif not isdefined("cookie.sctps")>
          <cfcookie name="sctps" value="1" expires="#times#">
          <cfset n=1>
          <cfelse>
          <cfset n=#cookie.sctps#+1>
          <cfcookie name="sctps" value="#n#" expires="#times#">
          </cfif>
          <cfif #cffile.ClientFileExt# is "gif" or #cffile.ClientFileExt# is "jpg" or #cffile.ClientFileExt# is "png" or #cffile.ClientFileExt# is "bmp" or #cffile.ClientFileExt# is "jpeg">
          <!--- <script>parent.cfform.message.value+="[uploadimage]#cffile.serverFile#[/uploadimage]"</sc ript> --->
          <cfif isdefined("n")>
          <cfoutput>
          <cfset session.n=#cffile.serverFile#>
          </cfoutput>
          </cfif>
          <cfoutput><font face="arial" class="fixed">已经成功上传图片。
          <a href onclick="javascript:window.open('home_imagepview.cfm','openWindow','width=300,height=330, top=10,left=600,menubar=no,resizable=no,scrollbars=no,status=no')">
          <u>预览</u></a>  
          <input name="cmdGocountry" type="image" ONCLICK="window.location.href='uploadfile.cfm?delete=1'" src="../image/image_del.gif" align="absbottom">
          <!--- <INPUT TYPE="BUTTON" NAME="cmdGocountry" VALUE=删除图片 ONCLICK="window.location.href='uploadfile.cfm?delete=1'"> --->
          <!--- <a href="uploadfile.cfm" onClick="<cffile action="delete" file="#expandpath("uploadfile\")##cffile.serverFile#">">删除图片</a> --->
          </font>
          </cfoutput>
          <cfelse>
          <script>parent.cfform.message.value+="[uploadrar]#cffile.serverFile#[/uploadrar]"</script >
          <a href="uploadfile.cfm">继续上传</a>
          </cfif></cfoutput></cfif>
          </table>
          <cfelse>
          <cffile action="delete" file="#expandpath("uploadfile\")##cffile.serverFile#">
          <center><font face="arial" class="fixed">出现错误,请选择图片<a href="javascript:history.back();">返回</a></font></center>
          </cfif>
          <cfcatch>
          <center><font face="arial" class="fixed">出现错误,请注意我们只允许上传指定格式的图片<a href="javascript:history.back();">返回</a></font></center>
          </cfcatch>
          </cftry>
          <cfelse>
          <center><font face="arial" class="fixed">出现错误,<a href="javascript:history.back();">返回</a><font></font></center>
          </cfif>
          </body>
          </html>


          • 2. Re: I cannot upload image to my Linux  server
            chinaeye Level 1
            Dear PaulH ,
            Would you like to give me some advice for the image uploading things under redhat enrionment. in Window our application works.

            thanks a lot
            David --adsbus.com
            • 3. Re: I cannot upload image to my Linux  server
              dlasley
              Did you check to make sure the directory where you are uploading images has writable permissions for the web server / coldfusion user?

              For example, if the directory is /srv/www/upload/images, the web server user is httpadm, and the web group is wwwusers, then the permissions should be something like:

              drwxrwxr-x httpadm wwwusers ...... /srv/www/upload/images

              If it does not have the right permissions, just chmod/chown to the desired combination, for example:

              chmod 775 /srv/www/upload/images
              chown httpadm:wwwusers /srv/www/upload/images

              (you have to be root to do this, by the way)

              HTH;
              &laz;