For example, Sina Weibo's APi for uploading images and sending messages also works in this mode. The parameter keywords are encapsulated in json and uploaded to the php server for processing, the file transfer function is not clear. I checked the information and said there are several types. One is to directly convert the image into two...
For example, Sina Weibo's APi for uploading images and sending messages also works in this mode. The parameter keywords are encapsulated in json and uploaded to the php server for processing, the file transfer function is not clear. I checked the information and said there are several types. One is to directly convert the image into a binary string and then serialize and deserialize the image. The other one is to use multipart/form-data for transmission. I don't quite understand that the transmission should be both json and file transfer. How can I encapsulate the data on the client, what does the php server do? Of course, it is no problem to upload json files or files separately.
Reply content:
For example, Sina Weibo's APi for uploading images and sending messages also works in this mode. The parameter keywords are encapsulated in json and uploaded to the php server for processing, the file transfer function is not clear. I checked the information and said there are several types. One is to directly convert the image into a binary string and then serialize and deserialize the image. The other one is to use multipart/form-data for transmission. I don't quite understand that the transmission should be both json and file transfer. How can I encapsulate the data on the client, what does the php server do? Of course, it is no problem to upload json files or files separately.
This interface is described in the documentMultipart/form-dataSubmit. You are not required to upload another json image. This interface does not use JSON.
If you use your method with JSON and files, JSON is treated as a common string, but this string is in JSON format. Then the interface will be changed to only two fields: json (described in this document) and pic, and the format of json fields is also specified.