0

I am using VSTS 2008 + C# + .Net 3.5 to develop a console application to upload a file to server. I want to show upload progress. I want to use WebClient.UploadProgressChanged Event, but confused about its function -- "Occurs when an asynchronous upload operation successfully transfers some or all of the data." My confusion is, when this event will be raised? The word "some or all" is too confusing, does it mean this event will be called each time 1% of file is upload? 10%? Some fixed bytes? Called randomly? Or something else?

http://msdn.microsoft.com/en-us/library/system.net.webclient.uploadprogresschanged.aspx

thanks in advance, George

1 Answer 1

1

It does kind of what it says. Expect many calls to the event for a big file and only 1 or 2 for a small page. The UploadProgressChangedEventArgs contains the relevant information.

Sign up to request clarification or add additional context in comments.

9 Comments

My confusion is what is the rule how often this method is called? Once per 1%? Being called when transfer some fixed number of bytes? Or being called purely random and can not estimate (e.g. even we transfer the same file, may be the 1st time upload 5 times progress change reported, the 2nd time upload 10 times progress reported)? Appreciate if you could random?
IF I could random? I'll try. I expect that it is implemented opportunistically, it wouldn't be worth it to do any accurate or round number based reporting. So take it as it comes. Why do you consider this so important?
A Progressbar in a Console application?
Any advice? Yes, just plug the procentComplete value into the Progressbar and don't worry. The whole thing was designed to give a (reasonable) feedback.
George2, I don't know such document.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.