0

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

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 操作工作正常。任何人都可以看到我的代码有问题吗?任何帮助,将不胜感激。

4

1 回答 1

2

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

于 2014-02-12T12:33:46.377 回答