Ticket #1692: 1692.patch

File 1692.patch, 2.5 KB (added by Wiktor Walc, 16 years ago)
  • editor/filemanager/connectors/cfm/cf_commands.cfm

     
    3232        <cfset var sFilePart = "">
    3333        <cfset var sFileExt = "">
    3434        <cfset var sFileUrl = "">
     35        <cfset var sTempDir = "">
    3536        <cfset var sTempFilePath = "">
    3637        <cfset var errorNumber = 0>
    3738        <cfset var customMsg = 0>
    3839        <cfset var counter = 0>
    3940        <cfset var destination = "">
    4041
    41     <cftry>
    42         <cffile action="UPLOAD" filefield="NewFile" destination="#GetTempDirectory()#" nameconflict="makeunique" mode="0755" />
     42        <cftry>
     43                <cfif isDefined( "REQUEST.Config.TempDirectory" )>
     44                        <cfset sTempDir = REQUEST.Config.TempDirectory>
     45                <cfelse>
     46                        <cfset sTempDir = GetTempDirectory()>
     47                </cfif>
     48                <cfif NOT DirectoryExists (sTempDir)>
     49                        <cfthrow message="Invalid temporary directory: #sTempDir#">
     50                </cfif>
     51
     52                <cffile action="UPLOAD" filefield="NewFile" destination="#sTempDir#" nameconflict="makeunique" mode="0755" />
    4353                <cfset sTempFilePath = CFFILE.ServerDirectory & REQUEST.fs & CFFILE.ServerFile>
    4454
    4555                <!--- Map the virtual path to the local server path. --->
     
    92102                </cfscript>
    93103
    94104                <cfset destination = sServerDir & sFileName>
    95 <!---
    96                 <cfdump var="#sTempFilePath#">
    97                 <cfoutput ><br /></cfoutput>
    98                 <cfdump var="#destination#">
    99                 <cfabort>
    100  --->
     105
    101106                <cflock name="#destination#" timeout="30" type="Exclusive">
    102107                <cftry>
    103108                        <cffile action="move" source="#sTempFilePath#" destination="#destination#" mode="755">
     
    120125                        <cfset customMsg = CFCATCH.Message >
    121126                </cfcatch>
    122127
    123     </cftry>
     128        </cftry>
    124129
    125130        <cfset SendUploadResults( errorNumber, sFileUrl, sFileName, customMsg ) >
    126131</cffunction>
  • editor/filemanager/connectors/cfm/config.cfm

     
    6161        // (This feature works in MX 6.0 and above))
    6262        Config.HtmlExtensions                                   = "html,htm,xml,xsd,txt,js" ;
    6363
     64        //Due to known issues with GetTempDirectory function, it is
     65        //recommended to set this vairiable to a valid directory
     66        //instead of using the GetTempDirectory function
     67        //(used by MX 6.0 and above)
     68        Config.TempDirectory = GetTempDirectory();
    6469
    6570//      Configuration settings for each Resource Type
    6671//
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy