open document picker and upload iOS swift
Solution:
var selectedDocPath: URL!
extension docVC: UIDocumentPickerDelegate {
func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) {
// Handle the selected PDF file here
let selectedURL = urls.first
selectedDocPath = selectedURL
uploadDoc()
// Process the selected PDF file
}
func documentPickerWasCancelled(_ controller: UIDocumentPickerViewController) {
// Handle cancellation
}
}
Use selectedDocPath to upload the file to server
Comments
Post a Comment