0 votes
by (200 points)

Whenever any file got failed to upload at the client side I don't get the exact idea by which reason the file got failed to upload so does rebex have any event or method by which at server side I can detect the reason for failed file and same notify at client side.

Applies to: Rebex SFTP

1 Answer

0 votes
by (147k points)
edited by

At the server side, you can register FileUploaded event handler. The event arguments contain HasFailed property, which can be used to determine whether the handle of the uploaded file was properly closed. If it was not, it indicates that the SFTP session most failed. However, please be aware that if the upload was canceled by the client side before the file was fully uploaded, and the handle has been closed, then it won't be possible to detect this as failed upload at the server. This is a limitation of the SFTP protocol.

At the client side (when using Rebex.Net.Sftp class), you can detect SFTP error codes and messages by catching and handling SftpException with relevant status code. See the linked post for details.

Update: Fixed the answer to address the server side as well.

...