http.forms.parse_form_data

http.forms

parse_form_data(boundary, body) -> args

Parse a multipart/form-data body into a key-value table

Parses a multipart/form-data body using the given boundary string, as the request's Content-Type carries it, unquoted. The boundary is matched as plain text. Each part's headers are read by name, in any case and in any order, up to the first blank line.

A text field comes back as its bytes as sent: no decoding, no escaping. The caller escapes one at output. A part with a non-empty filename comes back as a table with filename, content, and content_type, the part's Content-Type as sent, or nil when the part has none. An empty filename, which a browser sends for an empty file input, makes a text field. A part with no name is skipped, and a later part replaces an earlier one of the same name.