views:

46

answers:

1

I want to get the complete url of selected image from photo library in iphone to NSString.

Is it possible

My code is

    NSString *  filePath;
    UIImagePickerController * picker;
    picker = [[UIImagePickerController alloc] init];
    picker.delegate = self;     
    picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    [self presentModalViewController:picker animated:YES];

    filePath = /* Here i ant to get the complete url of selected image*/

Please help

+1  A: 

So you want to send an image from UIImagePickerController to a ftp server. In your delegate method, take the in UIImagePickerControllerOriginalImage, which is a UIImage object, and call UIImageJPEGRepresentation() to create a JPEG file. Then you can send the JPEG file to your ftp server.

lucius
i converted image into jpg but its not sending now...I can send image from resource folder to ftp serverMy code filePath = [[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"xx"] ofType:@"jpg"];Here i am sending xx.jpg from resourse folder to server and working fine.How i can send library file
After converting to jpg how i will give url
The UIImageJPEGRepresentation gives you an NSData object from which you can pull the data directly and send to your FTP server. No need to write it to a file on the device.
Bearddo