I am working with a php developer, and he is expecting me to post a image to him. But I have tried everything, including afnetworking and nsurlconnection. He can receive file, but the image is broken. All I know is that he is receiving image without using a form, and I am trying to ask that Can I post a image without simulate form in iphone?
Asked
Active
Viewed 152 times
0
-
Look at my answer here http://stackoverflow.com/questions/15267539/how-to-upload-image-to-server-from-gallery-as-json-on-ios/15268014#15268014 – Tirth Apr 17 '13 at 11:40
1 Answers
1
First of all you need to convert the image into nsdata
NSData *imageData = UIImagePNGRepresentation(_image);
and then convert the nsdata to base64 string (you need to download the seperate file for base64)
NSString *encodedString=[imageData base64EncodedString];
so finally you can send the encoded string to your php server (you need to decode the encoded string in your php server to retrieve the image)

Pradeep
- 1,043
- 7
- 12