i need to upload a image from iphone gallery ,but i am not getting the path of the picked image (using image picker)
in the image picke
May be it will helpful for u
[picker dismissModalViewControllerAnimated:YES];
imageView.image= [info objectForKey:@"UIImagePickerControllerOriginalImage"];
NSData *webData = UIImagePNGRepresentation(imageView.image);
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *localFilePath = [documentsDirectory stringByAppendingPathComponent:png];
[webData writeToFile:localFilePath atomically:YES];
NSLog(@"localFilePath.%@",localFilePath);
UIImage *image = [UIImage imageWithContentsOfFile:localFilePath];
Convert your image in NSData
and then Upload this NSData
.
Your image in NSData
NSData *dataImage = UIImageJPEGRepresentation([info objectForKey:@"UIImagePickerControllerOriginalImage"],1);
Or you can convert yourImage in NSData
using
NSData *dataImage = UIImagePNGRepresentation(yourImageView.image);
For more read NSData Class Reference