Get the path of the image chosen from library using the following code in using Image Picker ViewController

- (void)imagePickerController:(UIImagePickerController *)picker

        didFinishPickingImage:(UIImage *)img

                  editingInfo:(NSDictionary *)editingInfo{

    [picker dismissModalViewControllerAnimated:YES];
    NSURL *imagePath = [editingInfo objectForKey:@"UIImagePickerControllerReferenceURL"];
    NSString *imageName = [imagePath lastPathComponent];
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    NSString *localFilePath = [documentsDirectory stringByAppendingPathComponent:imageName];
    NSLog(@"localFilePath.%@",localFilePath);

}

Here localFilePath variable will contains the full image URL of the file chosen.

Categorized in:

IOS,