Code Review Stack Exchange is a question and answer site for peer programmer code reviews. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
        <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]>

                    connection = "myConnection"
                    action = "getFile" 
                    name = "uploadFile" 
                    transferMode = "binary" 
                    failIfExists = "false"
                    localFile = "#slocal#" 
                    remoteFile = "#sremoteFile#" />

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

        <cfftp connection = "myConnection"
            action = "close"
            stopOnError = "Yes">    
share|improve this question
Could you give us more details on what you're trying to optimize? How many images are being FTP'd? What operating system are you using? – Ben Koshy Mar 6 '13 at 15:02
The number of images can vary from 1 to 100 and usning Windows Server. – user22818 Mar 6 '13 at 15:18

In my experience, FTP can use up a lot of network packets and CPU time just negotiating the starting and finishing of a single file. If there exists the option of having an archive uncompressed at the destination, I would suggest zipping the images into a single file for transport.

To get even more performance for the end user making the CF request you could perform the FTP transfer in an asynchronous thread via cfthread. Launch the thread that zips and sends the file and let the user know that the data is on its way.

Hope this helps, or at least inspires some new ideas.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.