Closed deshan closed 7 years ago
Try to do the following:
mServer.resource["^/string$"]["POST"] = [](shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> request) {
auto decoded = SimpleWeb::Crypto::Base64::decode(request->content.string());
}
But it depends on how the request look. Feel free to post an example request here, as it then would be easier to help you.
You can also use SimpleWeb::QueryString::parse
on the content if the content is a query string, that is regular form post.
If I do string encode it nicely decode at the server. The issue is with image byte encode. Not sure about the way parse at the server. Will try your solutions and update here. Thanks you very much for the quick response.
Still no success, the base54 encoded image byte I send doensn't decode but if it's a string then it works.
Instead of java client I would try the sample c++ client provided to send the image. Does some one tried this before for Sending Image from client and read back in the server?
Do I have to use multipart? What are the modification I have to do to read multipart?
Thanks deshan
Not sure why Base64 is used as it requires more bytes than when sending binary data, but disregarding that, it would help a lot if you posted an example request sent from the client. That is, how does the header look like, and how does the content look like.
Hi,
From my java client I want to send a image to server. What I am doing is convert image to bytes and then do base64 encoding and send with http post request.
At the server I am trying to get the response, do base64 decode and create the image again. But when I do base64 decoding it fails and return nothing. So I am wonder what I am doing is wrong. The encoded base64 string not ok with http response?
Here is my code
Thanks Deshan
edit (eidheim): made it more readable