http file post

Dave Yerrington xgote at k-theory.com
Mon Jun 14 18:02:07 EDT 2004


Kind of rough but I figured it out.  If anyone finds this usefull:

HTTP File upload handler with progress indicator
http://projects.battlestyle.org/

-dave

----- Original Message ----- 
From: "Tim Roberts" <timr at probo.com>
Newsgroups: comp.lang.python
To: <python-list at python.org>
Sent: Monday, May 31, 2004 5:37 PM
Subject: Re: http file post


> 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.
> -- 
> http://mail.python.org/mailman/listinfo/python-list
>





More information about the Python-list mailing list