有没有办法优化此文件传输脚本?

时间:2013-03-06 14:56:40

标签: coldfusion cfml cfftp

我使用下面的ColdFusion脚本从ftp服务器复制图像。我不确定是否有其他/更好的方法来做到这一点。因为传输图像需要很长时间。

<cfftp connection = "myConnection" 
    username = "#username#"
    password = "#password#"
    server = "#server#"
    action = "open" 
    timeout = "500"
    stopOnError = "Yes">                

<cfloop index="i" from="1" to="#ArrayLen(ImagesArray)#">    

     <cfset slocal = "temp\" & ImagesArray[i] >
     <cfset sremoteFile = "Images\" & ImagesArray[i]>

     <cftry>                
          <cfftp 
               connection = "myConnection"
               action = "getFile" 
               name = "uploadFile" 
               transferMode = "binary" 
               failIfExists = "false"
               localFile = "#slocal#" 
               remoteFile = "#sremoteFile#" />
          <cfcatch>
               <cfabort>
          </cfcatch>
      </cftry>

      <cfset files = files & "|" & slocalFile>      
      <cfset fileliste = fileliste & arFiles[i] & "|">  
</cfloop>   

<cfftp connection = "myConnection"
     action = "close"
     stopOnError = "Yes">   

0 个答案:

没有答案
相关问题