[mod_python] Upload progress indicator shows after upload?

Nicolas Lehuen nicolas at lehuen.com
Thu Aug 3 11:35:44 EDT 2006


Alas, the progress bar is very small and un-noticeable, and it doesn't tell
the user how much bytes remain to be transferred nor a ETA.

This is the reason why so many people want to roll their own upload progress
bar. If only the people developing browsers could take a cue about this
problem... Well, I guess it's time to file a bug report for Mozilla /
Firefox, at least.

Nicolas Lehuen

2006/8/3, Mike Looijmans <nlv11281 at natlab.research.philips.com>:
>
> Most browsers already display a progress bar for uploads. That is the
> correct place for these things
> anyway.
>
> But don't underestimate the value that the marketing department attaches
> to "eye candy" features.
>
>
> Mike Looijmans
> Philips Natlab / Topic Automation
>
>
> Colin Bean wrote:
> > Definitely, I should have mentioned that the communication between the
> > filter and the handler would be a significant problem in itself.
> > Hopefully my initial description was scary enough that nobody tried it
> > :P
> >
> > I can see how an impatient user would think that a file upload wasn't
> > "working" if the browser didn't give them any feedback, but hopefully
> > anybody uploading very large files to your server can be trusted
> > understand the delay, or at least read some instructions that you
> > provide for them.
> >
> > Enough veering off topic; but I think part of the point here is that
> > any kind of progress bar like this is limited by the way HTTP file
> > uploads work, so this isn't really specific to mod_python. If a
> > framework somewhere provides an upload bar (using HTTP / HTML, at
> > least), it seems like it would have to use a kludge similar to what I
> > described above.  Correct me if I'm wrong...
> >
> > -Colin
> >
> >
> > On 8/2/06, Graham Dumpleton <grahamd at dscpl.com.au> wrote:
> >
> >> Colin Bean wrote ..
> >> > Unfortunately, what you're trying to do is more complicated than
> this.
> >> >  First of all, by the time your handler is called, the file has
> >> > already been sent over the network, and your handler is only reading
> >> > it from a tempfile on disk.  Also, a handler only sends one response
> >> > back after running to completion, so your code is behaving as
> >> > expected.  It finishes processing the file upload (including doing
> >> > everything in your loop), and when it's finished it sends a response
> >> > back to the client.
> >> >
> >> > Sorry I can't provide more constructive feedback having never
> actually
> >> > implemented something like this.  To take a guess at it, you'd need
> to
> >> > use an InputFilter to examine the upload request as it is read (I
> >> > believe this phase happens before the tempfile is written to disk),
> >> > and this would need to somehow communicate with another mod_python
> >> > handler which would return the current upload progress.  The client
> >> > page wold have to keep polling this handler (with an XMLHttpRequest,
> >> > perhaps) and display the results it gets with each poll.  Yeah, it's
> >> > pretty ugly...
> >>
> >> Except that a subsequent request to try and monitor progress may in a
> >> multi
> >> process version of Apache end up at a different process and will not
> have
> >> access to where the original request is up to.
> >>
> >> In short, there are many reasons why a progress meter is hard to
> >> implement and
> >> may not even give a correct indication of what is happening anyway.
> >>
> >> Personally, I am not sure what the fascination is with them besides
> >> the eye
> >> candy value of it.
> >>
> >> Graham
> >>
> >> > HTH,
> >> > Colin
> >> >
> >> >
> >> > On 8/1/06, jadacyrus <jadacyrus at gmail.com> wrote:
> >> > > Essentially this is what I have setup for my upload script:
> >> > >
> >> > > [code]
> >> > >
> >> > > #HTML Stuff here
> >> > > #Declare variables etc...
> >> > >
> >> > >     while bytes_left >= 0:
> >> > >             fileData = req.form['filename'].file.read(1024)
> >> > >             filebuffer = filebuffer + fileData
> >> > >             bytes_left = bytes_left - 1024
> >> > >             bytes_read = bytes_read + 1024
> >> > >             percent = bytes_read/int(length) * 100
> >> > >
> >> > > #Some nested IF statements to display a progress indicator using
> >> images
> >> > > based on the percent variable.
> >> > >
> >> > > [/code]
> >> > >
> >> > > This is contained in my upload.py in the function upFile which is
> >> called
> >> > > from the POST method. However, It seems that the file uploads
> >> completely
> >> > > first and then it will show the progress indications afterwards.
> >> However
> >> > > this doesn't seem to be logically what my code should be doing. I'm
> >> > > somewhat new to mod_python but not python in general, any
> >> suggestions?
> >> > > _______________________________________________
> >> > > Mod_python mailing list
> >> > > Mod_python at modpython.org
> >> > > http://mailman.modpython.org/mailman/listinfo/mod_python
> >> > >
> >> > _______________________________________________
> >> > Mod_python mailing list
> >> > Mod_python at modpython.org
> >> > http://mailman.modpython.org/mailman/listinfo/mod_python
> >>
> > _______________________________________________
> > Mod_python mailing list
> > Mod_python at modpython.org
> > http://mailman.modpython.org/mailman/listinfo/mod_python
> >
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20060803/673c3b98/attachment.html


More information about the Mod_python mailing list