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

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

Convert NsNumber, NSDate to String in iOS Swift

Global LocationManager Singleton class iOS Swift