locked
?? [Mango Bug] WebClient upload UploadProgressChanged is driving me crazyReply Quote Edit RRS feed

  • General discussion

  • Hi,
     What I am trying to achieve is to have a progress update for a file upload/download. For downloading using WebClient it is working perfectly, but for Upload I cannot seem to make it work and I've already lost almost a day trying.

     What I've tried (both using WebClient):

    1. Using OpenWriteAsync: UploadProgressChanged doesn't get fired at all and writing in the stream returned by OpenWriteCompleted is instantaneous so there is no progress available

    2. Using UploadStringAsync: UploadProgressChanged fires twice but both of the events are strange. Immediately after calling UploadStringAsync with the data that I want to send the event UploadProgressChanged  fires with BytesSent= "AllBytesThatIWantToSend" (4MB) and TotalBytesToSend = -1 The second time it fires is when it finishes the upload (after 20 seconds or more depends of the speed) and the arguments have the same values as before. 

    What I am doing wrong?

    I've used for the tests the Mazaa RTM build and also the emulator in tools 7.1 RC1 both wth the same result.

    Please let me know what I am doing wrong or how I can achieve an upload progress event.


    Regards,
    Dan
    Friday, September 16, 2011 5:28 PM