Over a million developers have joined DZone.

Upload File With Http Client (multipart/form-data)

DZone's Guide to

Upload File With Http Client (multipart/form-data)

Free Resource

def post_multipart(host, 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.

See the rest of the implementation here

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}