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 picker delegate method i am doing the following
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[picker dismissModalViewControllerAnimated:YES];
imageView.image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
NSString *strImagePath = [info valueForKey:UIImagePickerControllerReferenceURL];
NSString *strImagePath1 = [info valueForKey:UIImagePickerControllerMediaURL];
NSLog(@"%@",strImagePath);
NSLog(@"%@",strImagePath1);
NSLog(@"%@",info);
}
and the info dictionary contains following key values
{
UIImagePickerControllerMediaType = "public.image";
UIImagePickerControllerOriginalImage = "<UIImage: 0x16adc0>";
UIImagePickerControllerReferenceURL = "assets-library://asset/asset.PNG?id=1000000153&ext=PNG";
}
i used the value for key UIImagePickerControllerReferenceURL as the image path to upload it to FTP but i couldnt upload the file, probably the path which i taking is incorrect.
can anybody help me out how can i take the actual path of the picked image using image picker
May be it will helpful for u
Convert your image in
NSData
and then Upload thisNSData
.Your image in NSData
Or you can convert yourImage in
NSData
usingFor more read NSData Class Reference