Question

I want to upload picture to aspx web page in the http post, the web page has two keys: image and id, i want to pass image to http post and user id. I saw many codes over stackoverflow, but i don't know how to use keys to pass the data. sorry for my bad English, thanks

Was it helpful?

Solution

A few options:

  1. Create a structure, possibly JSON, that has the ID and the image data and set that as the body.
  2. Send the ID in the header and the image data in the body.
  3. Send the ID in the query string.

OTHER TIPS

You should use multipart/form-data. The most simple solution is to use AFNetworking: AFNetworking example how to post multipart request

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top