Learn Courses My Dashboard

How to get image file name from ImagePicker

I am using ImagePicker with SwiftUI by UIImagePickerController. It can select an Image. But I want to know the original image file name also. Is there any way to do this?
I already tried this using following codes:

if let url = info[UIImagePickerController.InfoKey.imageURL] as? URL {
imagePicker.fileName = url.lastPathComponent
imagePicker.fileType = url.pathExtension

But above code gives the temporary image file name.

Please help.

Thanks and regards.

Does this thread from stack overflow shed any light on how to get the filename?