[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.python

How to handle file uploads with http.server

Neil Blue

3/11/2010 10:30:00 AM

Hello,

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)

Please can anyone offer some insight into this or somewhere else I may find
some more information.

Thanks
Neil

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

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

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