How to handle file uploads with http.server

Neil Blue Neil.Blue at biowisdom.com
Wed Mar 17 05:12:33 EDT 2010


Thanks Gabriel

Yep, that looks like the same one. 

Cheers
Neil

 

-----Original Message-----
From: Gabriel Genellina [mailto:gagsl-py2 at yahoo.com.ar] 
Sent: 17 March 2010 02:08
To: python-list at python.org
Subject: Re: How to handle file uploads with http.server

En Thu, 11 Mar 2010 07:30:24 -0300, Neil Blue <Neil.Blue at 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/issue8077

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

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

--
Gabriel Genellina



********************************************* 

The information contained in this message is likely to be confidential.  It is intended only for the person named above.  Any dissemination, distribution, copying, disclosure or use of this message or its contents unless authorised by BioWisdom Ltd is strictly prohibited. Any views or opinions expressed within this e-mail are those of the author and do not necessarily represent those of BioWisdom Ltd. If you have received this message in error, please immediately notify us and delete it.  Thank you.  Registered Office: BioWisdom Ltd, Harston Mill, Harston, Cambridge, CB22 7GG.  Registered in England: (GB) 3861669.  VAT registered: (GB) 750899881.  Tel: +44 (0)1223 874800, Fax: +44 (0) 1223 874801, Internet:www.biowisdom.com 

*********************************************




More information about the Python-list mailing list