[Zope] Progress bar for file upload
Andrew Milton
akm at theinternet.com.au
Sun Feb 12 22:35:30 EST 2006
+-------[ Tarek Ziad? ]----------------------
| Andrew Milton wrote:
|
| >+-------[ Bruno Grampa ]----------------------
| >| Hello,
| >| what is the better way to implement a simple progress bar when uploading
| >| a file in Zope?
| >
| >The way I did it was to write a FS Product to handles uploads and that spawns
| >a new thread for each upload. You should generate an id and redirect to a
| >status page that can render any graphs you need (based on the id).
| >
| >
| >
| interesting, how do you know in your thread the progress of data (i mean
| the %) that is beeing uploaded on the server ?
To try and stem the flood of "how does it work" emails..
Long story short is I cheat. d8)
You need some JavaScript to actually do the submission, which then pops up a
status window which shows a Zope page that refreshes.
The actual submission is to a small CGI that handles updating the status inside
Zope via XMLRPC (you could also update a response file that the product could
check as well, but, that's just more files that have to be written to and
removed), when it's complete it passes in the location of the file(s) to the
Zope Product so it can process them further (by spawning a worker thread, so
you don't stop Zope from responding to requests).
Part of the product also just draws a status graph giving a message saying
what is happening and what the progress is, if there's more processing to be
done (parsing or whatever), the graph can continue to be updated.
When I said outside the box, I was pretty serious about being outside the box
d8) Obviously you need to have some webserver available that can run CGIs, and
talk to Zope, and (in this case is local to Zope for the file handling to
work). It doesn't have to be in front of Zope.
--
Andrew Milton
akm at theinternet.com.au
More information about the Zope
mailing list