I am using Renci.Ssh.Net to upload file at SFTP location.
using (SftpClient client = new SftpClient(host, port, sftpUser, sftpPassword))
{
client.Connect();
if (client.IsConnected)
{
client.BufferSize = 1024;
var filePath = sftpDir + fileName;
client.UploadFile(memoryStream, filePath, (o) =>
{
isUploaded = true;
});
client.Disconnect();
}
client.Dispose();
}
How can I verify if file is successfully uploaded?UploadFile() function's 3rd parameter is callback action.I tried to print the bytes (o) inside callback, but it seems UploadFile() uploads bytes in chunks,not all bytes at once, so I found bytes to be printed multiple times.
How can I use callback to verify successful upload?
Thanks.