You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I have a small problem and do not know if this is my mistake or a bug.
I use the SftpClient to upload a file. For this I use BeginUploadFile with Filestream.
In the end I check with uploadhandler.UploadedBytes if the file was uploaded correctly.
But there always comes a different result out and only occasionally the right number.
Here is the simplified code:
SftpClient client = new SftpClient(host, port, user, password);
client.Connect();
FileStream fileStream = new FileStream(source, FileMode.Open);
SftpUploadAsyncResult uploadhandler = client.BeginUploadFile(fileStream, target, null, null) as SftpUploadAsyncResult;
while (!uploadhandler.IsCompleted)
{
Thread.Sleep(500);
}
client.EndUploadFile(uploadhandler);
FileInfo fi = new FileInfo(source);
if (uploadhandler.UploadedBytes == Convert.ToUInt64(fi.Length))
{
return true;
} else {
return false
}
The text was updated successfully, but these errors were encountered:
We also noticed the value returned in the UploadedBytes property wasn't reliable. I was hoping to use it to determine if an upload was successful, but we resorted to using Exists() instead.
Hello,
I have a small problem and do not know if this is my mistake or a bug.
I use the SftpClient to upload a file. For this I use BeginUploadFile with Filestream.
In the end I check with uploadhandler.UploadedBytes if the file was uploaded correctly.
But there always comes a different result out and only occasionally the right number.
Here is the simplified code:
The text was updated successfully, but these errors were encountered: