Skip to content

AFormMultipart#

Web multipart/form-data representation.

Header:#include <AUI/Curl/AFormMultipart.h>
CMake:aui_link(my_target PUBLIC aui::curl)

Detailed Description#

A map from the field name to value (string, byte buffer or input stream, optionally with filename and mimeType). Pass it to ACurl::Builder::withMultipart to upload form fields and files in a single request; the Content-Type header with the boundary is set automatically.

AFormMultipart form;
form["description"] = { .value = AString("My photo") };
form["file"] = { .value = _new<AFileInputStream>("photo.png"), .filename = AString("photo.png"), .mimeType = AString("image/png") };
ACurl::Builder("https://example.com/upload").withMethod(ACurl::Method::HTTP_POST).withMultipart(form).runBlocking();