UIDocumentPickerViewController to pick some document and upload into AWS S3 with help of TransferUtility. Here, While uploading I need to show upload file name, status(progressive loader %),size into tableview cell. If i upload multiple files tableview cell need to show multiple cell with loading status.
Issues:
I have done UIDocumentPickerViewController to pick some documents and get those document URL,name,size,etc. but I don't know how to use (or) pass those values into upload part.
// MARK - File Storage Access public func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentAt url: URL) { let fileurl: URL = url as URL let filename = url.lastPathComponent let fileextension = url.pathExtension let filedata = url.dataRepresentation print("DATA: \(filedata)","URL: \(fileurl)", "NAME: \(filename)", "EXTENSION: \(fileextension)")}
//Need to store above values and use it to below functions
Below upload part how to interact with tableview cell.
transferUtility.uploadData(data,bucket: S3BucketName,key: name,contentType: "text/plain",expression: expression,completionHandler: completionHandler).continueWith { (task) -> AnyObject? in
if let error = task.error {
print("Error: \(error.localizedDescription)")
DispatchQueue.main.async {
cells.statusLabel_util.text = "Failed"
print("Failed")
}
}
if let _ = task.result {
DispatchQueue.main.async {
print("Upload Starting!")
}
// Do something with uploadTask.
}
return nil;
}