cfftp - error during the FTP getFile operation

1.9k views Asked by At

I am trying to get a file from a remote server and getting an error:

An error occurred during the FTP getFile operation.

The code that I have:

<cfsetting requesttimeout = "3600">

<h1>FTP Connect</h1>
<!--- O P E N --->
<cfftp action = "open"
    server = "#application.server#"
    username="#application.username#"
    password="#application.password#"
    connection = "#application.connection#"
    passive = "#application.passive#">

Did it open connection? <cfoutput>#cfftp.succeeded#</cfoutput><br />


<cfif cfftp.succeeded>

    <cfftp action = "LISTDIR"
        stopOnError = "Yes"
        name = "ListFiles"
        directory = "/www/rentproFeed/"
        connection = "#application.connection#"
        passive = "Yes">

    <cfquery dbtype="query"  name="GetSomeContents">
        SELECT MAX(name) AS latestFeed
        FROM ListFiles
    </cfquery>

    <cfoutput query="GetSomeContents">
        <cfset variables.latestProperties = #latestFeed# >
        #variables.latestProperties#
    </cfoutput>

    <cfftp
        action="getFile"
        connection= "#application.connection#"
        remotefile="/www/rentproFeed/#GetSomeContents.latestFeed#"
        localfile="#expandpath("../properties-feed/")#properties-feed.BLM"
        failIfExists="no">

    Did it downloaded the latest feed file? <cfoutput>#cfftp.succeeded#</cfoutput><br />

    <!--- <cfdump var="#ListFiles#" > --->

    <cfftp action="getFile"
        connection="#application.connection#"
        remoteFile="/www/rentproFeed/01014.zip"
        localFile="#ExpandPath('../properties-feed/latestImages.zip')#"
        failifexists="no"
        <!--- retrycount="10" --->
        >
        <cfoutput>
            FTP Operation Return Value: #cfftp.returnValue# <br/>
            FTP Operation Successful: #cfftp.succeeded# <br/>
            FTFP Operation Error Code: #cfftp.errorCode# <br/>
            FTP Operation Error Message: #cfftp.errorCode#<br/>
            FTP Operation Error Message: #cfftp.errorText# <br/>
        </cfoutput>

</cfif>



<cfftp action="close" connection="#application.connection#" stopOnError="yes">

Did it closed connection? <cfoutput>#cfftp.succeeded#</cfoutput>

<cfabort>

The error occurs when I want to get the "01014.zip" file. The previous getFile action works fine. Can anyone see some problem with my code? Any help would be appreciated.

1

There are 1 answers

0
Roman On

I found the solution to my problem: The .zip file has 15MB and by default the cfftp timeout is 30 seconds. I increased the timeout and it solved it.