You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 1, 2026. It is now read-only.
The C++ REST SDK does not provide a direct interface for creating multipart form data. I am unable to add both a file stream and key-value pairs to the body of the request simultaneously.
data << "--" << boundary << "\r\n"; data << "Content-Disposition: form-data; name=\"key\"\r\n\r\n" << pixkey << "\r\n"; data << "--" << boundary << "\r\nContent-Disposition: form-data; name=\"callback\"\r\n\r\n" << value << "\r\n"; data << "--" << boundary << "\r\nContent-Disposition: form-data; name=\"policy\"\r\n\r\n" << fdata.policy << "\r\n"; data << "--" << boundary << "\r\nContent-Disposition: form-data; name=\"Signature\"\r\n\r\n" << fdata.Signature << "\r\n"; data << "--" << boundary << "\r\nContent-Disposition: form-data; name=\"OSSAccessKeyId\"\r\n\r\n" << fdata.OSSAccessKeyId << "\r\n"; m_request.set_body(p.second, "multipart/form-data; boundary=" + boundary );
I would like to use both of the above methods to populate the body simultaneously. I want to retrieve the file using a stream instead of converting it into a string and placing it in a key-value pair. How can I put the stream data into a key-value pair?read_entire_file(strm.first) is the std::string of file. data << "--" << boundary << "Content-Type: application/octet-stream\r\n\r\n" << read_entire_file(strm.first) << "\r\n\r\n";
The C++ REST SDK does not provide a direct interface for creating multipart form data. I am unable to add both a file stream and key-value pairs to the body of the request simultaneously.
`http_client client(U("http://example.com"));
data << "--" << boundary << "\r\n"; data << "Content-Disposition: form-data; name=\"key\"\r\n\r\n" << pixkey << "\r\n"; data << "--" << boundary << "\r\nContent-Disposition: form-data; name=\"callback\"\r\n\r\n" << value << "\r\n"; data << "--" << boundary << "\r\nContent-Disposition: form-data; name=\"policy\"\r\n\r\n" << fdata.policy << "\r\n"; data << "--" << boundary << "\r\nContent-Disposition: form-data; name=\"Signature\"\r\n\r\n" << fdata.Signature << "\r\n"; data << "--" << boundary << "\r\nContent-Disposition: form-data; name=\"OSSAccessKeyId\"\r\n\r\n" << fdata.OSSAccessKeyId << "\r\n"; m_request.set_body(p.second, "multipart/form-data; boundary=" + boundary );I would like to use both of the above methods to populate the body simultaneously. I want to retrieve the file using a stream instead of converting it into a string and placing it in a key-value pair. How can I put the stream data into a key-value pair?
read_entire_file(strm.first)is the std::string of file.data << "--" << boundary << "Content-Type: application/octet-stream\r\n\r\n" << read_entire_file(strm.first) << "\r\n\r\n";