-1

I am new to iPhone technology. I want to post an image with data to a web server. To do so, I am trying to store the image in a local DB. After doing so, in order to send the data to the server, I am changing the image into NSData & now I want to send this image.

Can we send only NSData object to the server for getting the image on the server?

Or do we need to change NSData into base64string?

yuji
  • 16,695
  • 4
  • 63
  • 64
jaydev
  • 9
  • 2

1 Answers1

0

Try something like this:

You can set the HTTP method to use POST instead of the default GET using something like this:

 NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:myURL];
 [request setHTTPMethod:@"POST"];

And inject your desired data using:

 [request setHTTPBody: myData];

For more details kindly see this Question:

Invoking a http post URL from iphone using .net web service

Community
  • 1
  • 1
Ahmad Kayyali
  • 8,233
  • 13
  • 49
  • 83