Search code examples
c#.netwinscpwinscp-net

Check if a file transferred successfully in WinSCP, when using the Session.PutFile function


I am trying to send some files to a remote FTP server, and I need to make sure the files actually make it there before I continue my code.

Is there a way to check if the file transferred successfully using the Session.PutFile method? It doesn't have the TransferOperationResult return type that Session.PutFiles does, and in fact returns void.

If at all possible, I would like to handle the files as Stream objects in memory, rather than saving them locally.


Solution

  • The Session.PutFile raises an exception, if any error occurs.

    If it does not raise any exception, the upload was successful.