[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

Re: How to handle file uploads with http.server

Gabriel Genellina

3/17/2010 2:08:00 AM

En Thu, 11 Mar 2010 07:30:24 -0300, Neil Blue <Neil.Blue@biowisdom.com>
escribió:

> I have a basic http.server instance running (class
> HTTPHandler(http.server.BaseHTTPRequestHandler), with python 3.1, and I
> would like to upload files with multipart forms.
>
> def do_POST(self):
> ctype, pdict = cgi.parse_header(self.headers['Content-Type'])
> if ctype=='multipart/form-data':
> print('parsing...')
> query=cgi.parse_multipart(self.rfile, pdict)
> print(query)
>
> However the file never seems to finish being parsed. There are no errors,
> but the call hangs at: query=cgi.parse_multipart(self.rfile, pdict)

This may be related to this bug:

http://bugs.python.org...

reported last week by Mitchell L. Model in this thread:

http://groups.google.com/group/comp.lang.python/t/8a7752b...

--
Gabriel Genellina