Copy binary image data into a string
I need to send image data over network using HttpSendRequest POST request. For this purpose I am creating a string , adding some parameters to string, then I need to add raw image data.
Now 开发者_如何学GoI would like to know how can I send the image in post request.
Just pass the image data to the lpOptional
parameter.
If by chance you're trying to mimic the user pressing the submit button, you'll first have to format the body of the HTTP request to conform to application/x-www-form-urlencoded
or in this case multipart/form-data
content type.
If you just need to pass the data into a string and decode it on the server side, look into applying a base64 encoding on it before sending and base64 decoding upon receiving.
精彩评论