http file post
timr at probo.com
Tue Jun 1 02:37:54 CEST 2004
Dave <xgote at k-theory.com> wrote:
>Ive been trying to figure out how I can write to a file from an HTTP
>post while it is being uploaded. So far ive realized that my script
>isn't getting the data until the browser is done uploading. What I want
>to accomplish is a way to track the progress of a file upload.
This IS possible, but you'll have to do some work.
I assume this is a CGI script, and that you're using cgi.FieldStorage() to
fetch the POST contents. The key problem for you is that
cgi.FieldStorage() (and, more specifically, cgi.FieldStorage.read_binary)
does not return until the entire transmission is complete.
Now that you know that, your path should be clear: all you need to do is
make your own custom version of FieldStorage that updates a status variable
somewhere. Piece of cake!
- Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the Python-list