0 votes
by (120 points)


I'm currently trying the Rebex SFTP DLL.

I want to upload a file with the PutFile method.
I pass data to this method as a MemoryStream.

All works fine, no exception, no error in the log file.

But the file's size on the sever is always 0 byte.

Please note I'm using the trial version... Is it the cause of the problem ?

Applies to: Rebex SFTP

1 Answer

0 votes
by (69.1k points)

Hello, can you please share your code here (work with MemoryStream and PutFile() method is enough).

Please, ensure that you have correct MemoryStream.Position before you call the PutFile() method.

For example:

// initialize MemoryStream
var ms = new MemoryStream();
ms.Write(someByteArray, 0, 4);

// reset MemoryStream.Position
ms.Position = 0;

// upload data from MemoryStream to server
sftpClient.PutFile(ms, "filename.txt");
by (120 points)
Yes, it works !

The problem was the Position property that need to be set to 0.

Thank you for your help !