Unable to get file name Uning UIImagePickerController

34 Views Asked by At

I am newbie in swift i stuck in a little problem. I am attaching image using UIImagePickerController. Good thing is that successfully attached an image but unable to get attached file name. I tried several solutions like

UIImagePickerControllerImageURL, UIImagePickerControllerImageRefrenceURL,
UIImagePickerControllerPHAsset but didn't succeeded Please guide me and thanks in advance

1

There are 1 best solutions below

2
Mauli On

As per your question, you will get your point in the didFinishPickingMediaWithInfo method , where you get info object in above method in that included all info about your file.

Check below code:

let imageURL = info[UIImagePickerControllerImageURL] as! URL
print(imageURL.lastPathComponent)

Happy coding.