cfftp - FTP getFile操作期间出错

时间:2014-02-12 11:10:09

标签: coldfusion remote-access cfftp

我正在尝试从远程服务器获取文件并收到错误:

  

FTP getFile操作期间发生错误。

我的代码:

<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>

当我想获取“01014.zip”文件时,会发生错误。之前的getFile操作正常。任何人都可以看到我的代码有问题吗?任何帮助,将不胜感激。

1 个答案:

答案 0 :(得分:2)

我找到了解决问题的方法:.zip文件有15MB,默认情况下,cfftp超时为30秒。我增加了超时并解决了它。