When I upload a file complete, I checked the result and found HTTP header infomation has written into the file, like this:
tail is:
Left side is http server recived, right is source.
My code:
Poco::Net::HTTPClientSession session(uri.getHost(), uri.getPort());
Poco::Net::HTTPRequest req(Poco::Net::HTTPRequest::HTTP_PUT, uri.getPathAndQuery(),
Poco::Net::HTTPMessage::HTTP_1_1);
Poco::Net::HTMLForm form(Poco::Net::HTMLForm::ENCODING_MULTIPART);
form.addPart("file", new Poco::Net::FilePartSource(file_name,"application/octet-stream"));
form.prepareSubmit(req);
form.write(session.sendRequest(req));
std::istream& iss = session.receiveResponse(res);
Poco::StreamCopier::copyStream(iss, std::cout);
How to fix the problem
I want to know how to upload a binrary file use Poco::Net::HTTPClient