mochiweb_multipart

Utilities for parsing multipart/form-data.

Utilities for parsing multipart/form-data.

DATA TYPES

bodypart() = {Start::integer(), End::integer(), Body::iolist()}
file_handler() = (Filename::string(), ContentType::string()) -> file_handler_callback()
file_handler_callback() = (binary() | eof) -> file_handler_callback() | term()
formfile() = {Name::string(), ContentType::string(), Content::binary()}
header() = {key(), value()}
key() = atom() | string() | binary()
request()
value() = atom() | iolist() | integer()

Functions


default_file_handler(Filename, ContentType) -> term()

parse_form(Req::request()) -> [{string(), string() | formfile()}]

Parse a multipart form from the given request using the in-memory default_file_handler/2.

parse_form(Req::request(), F::file_handler()) -> [{string(), string() | term()}]

Parse a multipart form from the given request using the given file_handler().

parse_multipart_request(Req, Callback) -> term()

parts_to_body(BodyList::[bodypart()], ContentType::string(), Size::integer()) -> {[header()], iolist()}

Return {[header()], iolist()} representing the body for the given parts, may be a single part or multipart.

parts_to_multipart_body(BodyList::[bodypart()], ContentType::string(), Size::integer(), Boundary::string()) -> {[header()], iolist()}

Return {[header()], iolist()} representing the body for the given parts, always a multipart response.

Bob Ippolito bob@mochimedia.com
View Functions