I use the didPickDocumentAt function to retrieve the url of the picked file in the DocumentPickerViewController. I have a multipart upload function that uses alamofire to upload files to the backend.
func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentAt url: URL) {
print(url)
uploadMultipartFile()
}
My question is: How can I get a data representation of the file I have picked so I can pass it to my uploadMultipartFile function?
The Files can be pdf, .docx, or any kind of file. What is the approach?