Archived Forum Post

Index of archived forum posts

Question:

"no such file" Error in SFTP UploadFileByName

Dec 27 '12 at 09:42

My call to Chilkat.SFtp.UploadFileByName fails with this information in the LastErrorText:

    access: writeOnly
    createDisposition: createTruncate
    v3Flags: 0x1a
    Sent FXP_OPEN
    StatusResponseFromServer:
      Request: FXP_OPEN
      InformationReceivedFromServer:
        StatusCode: 2
        StatusMessage: No such file
      --InformationReceivedFromServer
    --StatusResponseFromServer

What is the problem? It seems I can upload using FileZilla or WSFTP.


Answer

It is a strange error. Here are a number of comments that can hopefully help.

1) It's not an error with opening the local file. The "no such file" error message is the error reply from the server in response to the file open/create request.

2) When using WSFTP or FileZilla, make sure you're actually using the SSH/SFTP protocol. Quite often, developers think they are doing the same thing, but are actually using the FTP protocol w/ these interactive tools.

3) When using WSFTP or FileZilla, make sure there are no automatic rules that switch the "home directory" to something else upon login.

4) Get your bearings on the server-side. Write test code to list the files in the HOME directory. Here is a VB6 example: http://www.example-code.com/vb/sftp_readDir.asp Do you see the files you expect to see?

5) Another way to get your bearings: Use the RealPath method to find out the absolute directory path on the server-side for ".", which would be the HOME directory of your user account. Here's a VB6 example: http://www.example-code.com/vb/sftp_realPath.asp

6) Maybe it's an error having to do with the access and createDisposition values used when opening the file. The UploadFileByName method does not give any alternate choices -- it uses the typical values one would need for creating/uploading a file. Test using the OpenFile method using different values, such as "readWrite" instead of "writeOnly". See the reference documentation for all possible values.

7) Maybe a file with the same name already exists, and permissions are such that you cannot overwrite it?