[Web-SIG] transaction progress with cgi.FieldStorage
Clark C. Evans
cce at clarkevans.com
Fri Dec 30 00:31:26 CET 2005
On Thu, Dec 22, 2005 at 12:24:59PM -0500, kai wrote:
| this is my first post on this list. I am working on a way to monitor the
| progress of reading a file upload from wsgi.input. I can currently
| monitor the overall transfer and when individual files of a multiple
| file upload are completed. The ultimate goal of this is to be able to
| display a progress meter when someone is uploading a file.
You could do this in a few stages:
#1 Use an async XMLHttpRequest on the client side to POST
the file to your file upload servlet; in the URL for the
post use a unique identifier, say MY-ID
#2 Override make_file /w your own that monitors how much
of the file's content has been sent; store that in a
global mapping using MY-ID as the key
#3 Create a monitor URL on your server that reads the mapping
and returns an hour glass or something /w a refresh page
#4 When you send your application request; open up an iframe
/w refresh setting to that monitor URL (using MY-ID)
Although, you've probably already done something similar...
| To do this I subclassed cgi.FieldStorage but when I finished I had
| modified most of the non-trivial methods just to hook in something to
| monitor the transfer progress, oops.
| Has anyone else found FieldStorage insufficient for certain tasks?
| Is there a general need for a more flexible FieldStorage replacement?
I've found make_file sufficient for all of my needs (so far)
More information about the Web-SIG