I'm using POCO to implement HTTP Upload file to URI, I use HTTPClientSession and l_HTTPReq with the method HTTP_PUT, but this does not work, i have a "Bad request response"
If you do not have control over what the server allows, then you probably won't be able to do that.
can you help me please with a sample code, especially how to set content of a file to URI, I want also to implement this for compressed files, tha means, setting zip file to URI
- Code: Select all
HTTPClientSession s("localhost", port);
HTTPRequest request(HTTPRequest::HTTP_POST, "/echo");
std::string body;
// fill the string with file contents here
request.setContentLength((int) body.length());
s.sendRequest(request) << body;
Of course, in the above example, you have to fill the string being
sent with the file contents (see this
post on how to do that) and provide appropriate HTTP server parameters to the
HTTPClientSession and HTTPRequest.
If you are looking for file compressing facilities in POCO, those do exist and work, but are still in the
sandbox.
Alex