Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you get image file name from UIImagePickerController?

I'm not getting the image name from photo library. Anyone here knows a proper way to get image name?

Note: PHAsset.fetchAssets(withALAssetURLs: [imageURL], options: nil) this is deprecated.

Swift only

Thanks

like image 504
Akshay Sood Avatar asked Nov 27 '22 16:11

Akshay Sood


1 Answers

I found a way

if let asset = info["UIImagePickerControllerPHAsset"] as? PHAsset{
            if let fileName = asset.value(forKey: "filename") as? String{
            print(fileName)
            }
        }

This will return you the actual file name in the photo library.

like image 146
Akshay Sood Avatar answered Dec 05 '22 15:12

Akshay Sood