0 votes
by (120 points)
edited

I have been using the following block of code in an application for the past several months without any problem and now all of the sudden I'm getting a SftpException with the error message of "No such file; File not found.".

    private void SendDataFtp(string data, string fileName)
    {
        byte[] fileContents = Encoding.UTF8.GetBytes(data);
        MemoryStream ms = new MemoryStream(fileContents);

        using (Sftp ftp = new Sftp())
        {
            ftp.Connect("address", 22);
            ftp.Login("username", "password");
            ftp.PutFile(ms, fileName);
        }
    }

I also updated my installation or at least I think I did. I'm using the following assemblies:

Rebex.Net.ProxySocket (version 2.0.4086.0) Rebex.Net.Sftp (version 2.0.4086.0) Rebex.Net.Ssh (version 2.0.4086.0)

What's the problem? Not sure why it's complaining that it can't find a file when I'm not trying to get a file but rather upload a file.

Scott

Applies to: Rebex SFTP

1 Answer

0 votes
by (144k points)
edited

This exception represents an error that was reported by the SFTP server and it's indeed a bit strange for the PutFile method. However, it might be related to a path, not the actual file name. To make it possible to tell what is going on, please create a log of communication using Sftp object's LogWriter property and either add it to your question or mail it to support@rebex.net Thanks!

...