Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3797826
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T13:28:09+00:00 2026-05-19T13:28:09+00:00

I have a WebClient which I use to upload a file in the following

  • 0

I have a WebClient which I use to upload a file in the following way, base64Encoded is a picture encoded as a base64 string as that is what the imgur server expects:

    public Upload()
    {
        WebClient webClient = new WebClient();
        webClient.UploadProgressChanged += new UploadProgressChangedEventHandler(webClient_UploadProgressChanged);
        webClient.UploadValuesCompleted += new UploadValuesCompletedEventHandler(webClient_UploadValuesCompleted);    

        NameValueCollection values = new NameValueCollection();
        values.Add("key", "imgur api key");
        values.Add("image", base64Encoded);
        webClient.UploadValuesAsync(new Uri("http://api.imgur.com/2/upload"), "POST", values);        
    }

This is the event handler for the UploadProgressChanged:

    private void webClient_UploadProgressChanged(object sender, UploadProgressChangedEventArgs e)
    {
        int percentage = e.ProgressPercentage * 2;

        progressBar.Value = percentage;
        percentageTextBlock.Text = (percentage).ToString() + "%";
    }

Now my problem is that the event handler is only called once right at the start, reports a ProgressPercentage of 50 and is then not being called anymore. The file uploads successfully, but my progressbar is not working. This is not because I’m uploading a small file as I’ve also tried this with files of several mb which also report a ProgressPercentage of 50 right away. e.BytesSent is no help either because that one is equal to e.TotalBytesToSend right away as well. What is going on here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T13:28:10+00:00Added an answer on May 19, 2026 at 1:28 pm

    There was a bug with this event which was fixed in .NET 4.0. And here’s a related post.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use System.Net.WebClient in a WinForms application to upload a file
I have in my Form constructor, after the InitializeComponent the following code: using (WebClient
I have the code below which I am using to upload files to my
Currently I have an application that receives an uploaded file from my web application.
I have a WebClient instance that receives data from a remote website. I referenced
Have just started using Visual Studio Professional's built-in unit testing features, which as I
Have you managed to get Aptana Studio debugging to work? I tried following this,
I have a web service in which I am manipulating POST and GET methods
I am trying to upload a file or stream of data to our web
I have a client which makes a limited number of concurrent web requests. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.