Coldfusion Secure FTP existsFile errors when file doesn't exist?

1k Views Asked by At

I am attempting to use the secure FTP ColdFusion functionality. I am running into an error with the fileExists function, only when using a secure connection. Instead of returning "no" when a file passed in doesn't exist it instead errors saying:

"An error occurred during the sFTP existsFile operation.

The system cannot find the path {file name}"

Picture of the error

The regular FTP stuff works perfectly (same code as below but different connection).

If the file does exist, then there is no problem and the file is deleted and written.

I feel this is a bug, but I am confirming that I am not doing something wrong or missing something.

<cfftp action="open"
    connection="ftp_connection"
    server="#this.server#"
    port="#this.port#"
    username="#this.username#"
    password="#this.password#"
    fingerprint="#this.fingerprint#"
    secure="yes"
    />

<cfftp action="existsFile"
    connection="ftp_connection"
    remotefile="#arguments.remote_name#"
    directory="/"
    />

  <cftry>
    <cfif cfftp.returnValue EQ "Yes" or cfftp.returnValue EQ "true">
      <cfftp action="remove" 
        connection="ftp_connection"
        item="#arguments.remote_name#"
        />
    </cfif>

    <cfftp action="putFile"
      connection="ftp_connection"
      passive="true"
      localfile="#ExpandPath('/vctemp/#arguments.local_name#')#"
      remotefile="#arguments.remote_name#"
      />
0

There are 0 best solutions below