views:

54

answers:

1

Hi all, 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 !!!

A: 
NSData* YourData= UIImageJPEGRepresentation(yourImage, 1.0); this will give you the data representation of your image
JonLOo
Thanks , I will try it.But how can I know I pass the image to NSData ?
WebberLai
i have posted you the way to convert an image into NSData
JonLOo
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.
WebberLai