i am using Webclient to upload data using Async call to a server,
WebClient webClient = new WebClient();
webClient.UploadDataAsync(uri , "PUT", buffer, userToken);
i've attached DatauploadProgress and DatauploadCompleted Events to appropriate callback functions
// Upload Date Progress
webClient.UploadProgressChanged += new
UploadProgressChangedEventHandler(UploadProgressCallback);
// Upload Date Progress
void UploadProgressCallback(object sender, UploadProgressChangedEventArgs e)
{
// Magic goes here
logger.writeToLog("Percentage =" + e.ProgressPercentage);
}
the e.ProgressPercentage
always returns 50
.. no matter what the size of the file uploaded was (tried different sizes between 10kb to 60mb ).
the function itself gets called only twice (really fast too) and percentage shows 50! ..which is illogical specially with big files ...
e.BytesSent
doesn't help either..it always shows the files size in bytes :S (ex: if the file size was 63,000 , i'd get e.BytesSent = 63,000
and e.ProgressPercentage= 50
Can someone point the problem out to me ?