How to handle file uploads with http.server

N

Neil Blue

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

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top