http file upload from Python (multipart/formdata) how-to?

Tim Roberts timr at probo.com
Fri Sep 27 01:12:57 EDT 2002


"Robert" <k.robert at gmx.de> wrote:

>want to upload file data (multipart formdata) - same as upload from
>web-browser <input type=file ..>
>
>urllib.urlencode  + urlopen takes only simple name/value tuples
>
>how do I render multipart formdata ?

I guess you will have to generate the HTTP/MIME headers and send the file
in your own code.  See RFC 1867.

Are you trying to interface with a web form that already exists, or are you
just trying to do a file transfer from one machine to another?
--
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.



More information about the Python-list mailing list