Re: How to handle file uploads with http.server

Discussion in 'Python' started by Gabriel Genellina, Mar 17, 2010.

  1. En Thu, 11 Mar 2010 07:30:24 -0300, Neil Blue <>
    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
    Gabriel Genellina, Mar 17, 2010
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. darrel
    Replies:
    3
    Views:
    522
    Juan T. Llibre
    Apr 22, 2006
  2. prefetch
    Replies:
    0
    Views:
    304
    prefetch
    Jul 29, 2004
  3. Brybot
    Replies:
    6
    Views:
    1,164
    John Saunders [MVP]
    Jul 9, 2007
  4. Neil Blue
    Replies:
    0
    Views:
    272
    Neil Blue
    Mar 11, 2010
  5. gberz3
    Replies:
    7
    Views:
    183
    Todd Fisher
    Jul 24, 2008
Loading...

Share This Page