I use Webclient to upload data using an Async call to the server,
WebClient webClient = new WebClient();
webClient.UploadDataAsync(uri , "PUT", buffer, userToken);
I have connected DatauploadProgress and DatauploadCompleted Events to the corresponding callback functions
webClient.UploadProgressChanged += new
UploadProgressChangedEventHandler(UploadProgressCallback);
void UploadProgressCallback(object sender, UploadProgressChangedEventArgs e)
{
logger.writeToLog("Percentage =" + e.ProgressPercentage);
}
e.ProgressPercentagealways returns 50.. no matter what the size of the downloaded file was (tried different sizes from 10 kb to 60 mb). the function itself is called only twice (very quickly), and the percentage shows 50! .. which is illogical especially with large files ...
e.BytesSentdoesn't help ... always shows the file size in bytes: S (for example: if the file size was 63,000, I would get e.BytesSent = 63,000ande.ProgressPercentage= 50
Can someone point out a problem?