0

I am using a "PUT" rest webservice to upload a file to One Drive.I have used both UploadDataAsync and UploadStringAsync methods of webclient. But in both cases the UploadProgressChanged event is only fired after the whole file is uploaded.Please suggest.I need to show progress of upload operation in progress bar.

 wc.UploadProgressChanged += new UploadProgressChangedEventHandler((sender, e) => webclient_UploadProgressChanged(sender, e, updateProgress));


                            wc.UploadStringCompleted += new UploadStringCompletedEventHandler(wc_UploadStringCompleted);
                            wc.UploadStringAsync(uriForUploading.Uri, "PUT", result);
V K
  • 1,645
  • 3
  • 26
  • 57
  • How big are the file(s) involved? – Damien_The_Unbeliever Apr 26 '16 at 07:42
  • Can we please see the code you are working with? Are you sure you're not binding the event handler after the UploadFileAsync call? You should first bind the event handler and then call UploadFileAsync. – Kerim Emurla Apr 26 '16 at 07:47
  • Most files were of a few KB and but one of them was of 2.4 MB.And while uploading this file I noticed the difference. – V K Apr 26 '16 at 08:07

1 Answers1

0

I tried using the uploadFileAsync funtion instead of uploadDataAsync, and it worked.Seems there is issue with WebClient class.

V K
  • 1,645
  • 3
  • 26
  • 57