1

I'm look for a solution to upload an image file to PHP server

I find some tutorial to get a photo from this video

and you can get source code here

How can I use an IBAction to send the photo to a URL server

for example I give it a URL:http://someaddress/photo_upd.php

or more specific, HOW TO CONVERT IMAGE I GET FROM CAMERA -> NSDATA ???

I think this discussion will be help,but I don't know how to use it ...

this is my program main function,I use a camera to take a photo

and I press a button It will send the image and the GPS location

now I only can send GPS location,but don't know how to upload the image

Hope someone know the solution !

Great thanks !!!

Community
  • 1
  • 1
Webber Lai
  • 2,014
  • 5
  • 35
  • 66

1 Answers1

0
NSData* YourData= UIImageJPEGRepresentation(yourImage, 1.0); this will give you the data representation of your image
JonLOo
  • 4,929
  • 1
  • 19
  • 27
  • Thanks , I will try it.But how can I know I pass the image to NSData ? – Webber Lai Oct 18 '10 at 09:21
  • i have posted you the way to convert an image into NSData – JonLOo Oct 18 '10 at 09:23
  • OK...I think it's really got data inside,thanks a lot .I use if (photoData == nil) { NSLog(@"The photo is nothing !!!"); } else { NSLog(@"Photo inside !!!!"); } to check data exist or not. – Webber Lai Oct 18 '10 at 09:37