[Web-SIG] file uploads

Greg Stein gstein at lyra.org
Fri Oct 24 16:24:40 EDT 2003

On Thu, Oct 23, 2003 at 07:08:29PM -0700, Bill Janssen wrote:
> > I certainly think a function for doing file uploads would be great,
> > though.
> def https_post_multipart(host, port, selector, fields, files):
>     """
>     Post fields and files to an http host as multipart/form-data.
>     FIELDS is a sequence of (name, value) elements for regular form fields.
>     FILES is a sequence of (name, filename [, value]) elements for data to be uploaded as files.
>     Return the server's response page.
>     """
>     content_type, body = encode_multipart_formdata(fields, files)
>     h = httplib.HTTPS(host, port)

Note that that class is deprecated.

In any "new" code which is developed [by this SIG], please stick with the
HTTP(S)Connection objects.


Greg Stein, http://www.lyra.org/

More information about the Web-SIG mailing list