Uploading files

auto resp=ua->request(x::http::POST, "http://localhost/cgi-bin/req.pl",
	              x::http::form::parameters::create("username",
                                                        "alfred",
                                                        "password",
                                                        "rosebud"),
                      "UTF-8",
                      "file", "upload.txt");

A character set name parameter optionally follows the HTTP form parameter. This encodes the form as a multipart/form-data MIME entity, which contains the all fields from the form parameter, in addition to the file uploads specified after the character set parameter.

RFC 2388 specifies that each field in a multipart/form-data has a specified character set. This comes from the character set parameter. Older HTTP servers may expect and assume that the field values use the same character set as the form that the form gets submitted from. For maximum compatibility, always specify the same character set as the form's. The character set parameter also specifies the character set of the field names and non-upload field values. The list of files to upload with the form follows the character set parameter. Each file can be specified in several ways: