I have to create feature for upload some document in pdf type and have to show name and file size with file that I selected from UIDocumentPickerViewController 's delegate
before upload it.
How can I get its name and file size ?
I have to create feature for upload some document in pdf type and have to show name and file size with file that I selected from UIDocumentPickerViewController 's delegate
before upload it.
How can I get its name and file size ?
In your
UIDocumentPickerDelegate
, you have will end up implementingdocumentPicker(_:didPickDocumentsAt:)
, which will give you an array ofURL
s. You can get the name of a file usingurl.lastPathComponent
.Regarding the file size, once you have the same
URL
from above, you can query the file size (may solutions listed here: Swift - Get file size from url):