Show Upload Progress

Discussion in 'ASP .Net' started by Jeff S, Apr 6, 2004.

  1. Jeff S

    Jeff S Guest

    I'm enabling users to upload files to the server. I'd like to show them some
    indication of percent complete. How can this be done?

    Thanks!
    Jeff S, Apr 6, 2004
    #1
    1. Advertising

  2. One solution is to use a timer. Set a flag to show that the load has
    started. Everytime the timer event fires examine the flag. As long as the
    flag is set, display your message. When it's done, change the flag and stop
    the timer.

    --
    Regards,
    Alvin Bruney [ASP.NET MVP]
    Got tidbits? Get it here...
    http://tinyurl.com/27cok
    "Jeff S" <> wrote in message
    news:...
    > I'm enabling users to upload files to the server. I'd like to show them

    some
    > indication of percent complete. How can this be done?
    >
    > Thanks!
    >
    >
    Alvin Bruney [MVP], Apr 6, 2004
    #2
    1. Advertising

  3. Jeff S

    Joe Fallon Guest

    This approach works to keep the user occupied while the file is uploaded.
    But it does not show true progress as a percentage of the task completed.

    ASP.Net blocks you from getting any data once the upload begins.
    So you have to write code to intercept the request and handle it yourself.

    In fact, to get a true percentage is extremely difficult. I read a thread on
    the topic that lasted almost 2 years. Some guys posted 90% of the code
    required to do it and then hired themselves out to 3rd party companies and
    built it for them. To my knowledge there is no free public domain code for
    how to do this.
    --
    Joe Fallon




    "Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
    news:...
    > One solution is to use a timer. Set a flag to show that the load has
    > started. Everytime the timer event fires examine the flag. As long as the
    > flag is set, display your message. When it's done, change the flag and

    stop
    > the timer.
    >
    > --
    > Regards,
    > Alvin Bruney [ASP.NET MVP]
    > Got tidbits? Get it here...
    > http://tinyurl.com/27cok
    > "Jeff S" <> wrote in message
    > news:...
    > > I'm enabling users to upload files to the server. I'd like to show them

    > some
    > > indication of percent complete. How can this be done?
    > >
    > > Thanks!
    > >
    > >

    >
    >
    Joe Fallon, Apr 6, 2004
    #3
  4. Jeff S

    Jeff S Guest

    Sounds like this will do for my situation. I understand it's not a true
    measure of progress, but in my situation I'm most interested in letting the
    user know that the upload is not hung and to please continue waiting. I'd
    hate for them to restart their session or repeatedly click the "upload now"
    button.

    I'm using the HtmlInputFile control, and I'm a bit sketchy on *how* it works
    (although I do have it all working). I suppose it works with the browser to
    enable navigation of the client machine to find the file to be uploaded, but
    beyond that I'm not sure what happens in order to copy the file from the
    client to the server. I have a separate button that initiates a postback:
    does the uploaded file come in as part of the POST (postback) data? If not,
    how doess it come in? Where and when would I initiate the timer? and where
    would I set the flag? I could figure it all out except that I'm just not
    clear on when/where in the code I'd get a chance to start the timer and set
    the flag prior to the upload actually beginning.

    Thanks.



    "Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
    news:...
    > One solution is to use a timer. Set a flag to show that the load has
    > started. Everytime the timer event fires examine the flag. As long as the
    > flag is set, display your message. When it's done, change the flag and

    stop
    > the timer.
    >
    > --
    > Regards,
    > Alvin Bruney [ASP.NET MVP]
    > Got tidbits? Get it here...
    > http://tinyurl.com/27cok
    > "Jeff S" <> wrote in message
    > news:...
    > > I'm enabling users to upload files to the server. I'd like to show them

    > some
    > > indication of percent complete. How can this be done?
    > >
    > > Thanks!
    > >
    > >

    >
    >
    Jeff S, Apr 6, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brian Birtle
    Replies:
    3
    Views:
    2,415
  2. Kenneth Keeley

    File Upload Progress

    Kenneth Keeley, Oct 21, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    3,363
    Kenneth Keeley
    Oct 21, 2003
  3. Garett

    Upload Progress in ASP.NET

    Garett, Apr 30, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    575
    bruce barker
    May 1, 2004
  4. Heather Fraser
    Replies:
    0
    Views:
    615
    Heather Fraser
    Jul 5, 2004
  5. Charlie Zhang
    Replies:
    3
    Views:
    1,244
    Paul Lutus
    Aug 16, 2004
Loading...

Share This Page