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
}
i am trying to assign chunck/partial file upload size, to make the Callback Function get called at chosen periodic times.
Note:
i know i can use e.BytesSent to read the bytes sent when the callback function gets called, but that’s not what i am trying to do.
You can’t define that chunk size, as
WebClientdoesn’t expose any property to handle that.If you want to control that packet length, you’ll need to transfer your file by custom code, i.e., by looping through your desired chunk size and, at server side, to implementa
System.Web.IHttpHandlerto rebuild your file in correct order.