简体   繁体   English

将二进制图像数据复制到字符串中

[英]Copy binary image data into a string

I need to send image data over network using HttpSendRequest POST request. 我需要使用HttpSendRequest POST请求通过网络发送图像数据。 For this purpose I am creating a string , adding some parameters to string, then I need to add raw image data. 为此,我正在创建一个string,在string中添加一些参数,然后需要添加原始图像数据。

Now I would like to know how can I send the image in post request. 现在,我想知道如何在后期请求中发送图像。

Just pass the image data to the lpOptional parameter. 只需将图像数据传递给lpOptional参数即可。

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. 如果碰巧您想模仿用户按下“提交”按钮,则首先必须格式化HTTP请求的正文,使其符合application/x-www-form-urlencoded或本例中的multipart/form-data内容类型。

如果只需要将数据传递到字符串中并在服务器端对其进行解码,请考虑在发送之前对它应用base64编码 ,并在接收时对其进行base64解码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM