Nov 5, 2014 at 11:36 AM
Edited Nov 5, 2014 at 12:11 PM
I wanted to POST an image to the SkyBiometry API. They support POST. but they said the following
"Note: in case where you want to POST images instead of specifying urls, request to the method must be formed as a MIME multi-part message sent using POST data. Each argument should be specified as a separate chunk of form data."
I have the image file on disk. How can I read it and send it in a POST request and the content type is MIME multi-part?????
My current code is
pplx::task<void> requestTaskPost = file_stream<unsigned char>::open_istream(L"image.png").then((basic_istream<unsigned char> fileStream)
// Make HTTP request with the file stream as the body.
//file_stream<unsigned char>::open_istream inputStream;
return client.request(req).then([fileStream](http_response response)
// Perform actions here to inspect the HTTP response...
if(response.status_code() == status_codes::OK)
std::cout << "Response OK" << std::endl;
What i get when i try this on the website:
, I get that 0 files uploaded.
How can I POST the image file in a request of multipart content type?
I didn't find a clear example on reading any type of files from Disk.