Marino Faggiana 6 years ago
parent
commit
2ee0e12254

+ 4 - 4
Share/CCloadItemData.swift

@@ -68,7 +68,7 @@ class CCloadItemData: NSObject {
                                         if let pngImageData = image.pngData() {
                                         
                                             let fileName = "\(dateFormatter.string(from: Date()))\(conuter).png"
-                                            let filenamePath = directory + "/" + fileName
+                                            let filenamePath = directory + fileName
                                         
                                             let result = (try? pngImageData.write(to: URL(fileURLWithPath: filenamePath), options: [.atomic])) != nil
                                         
@@ -91,7 +91,7 @@ class CCloadItemData: NSObject {
                                         // OLD fileName with date
                                         //let pathExtention = URL(fileURLWithPath: url.lastPathComponent).pathExtension
                                         //let fileName = "\(dateFormatter.string(from: Date()))\(conuter).\(pathExtention)"
-                                        let filenamePath = directory + "/" + fileName
+                                        let filenamePath = directory + fileName
                                         
                                         do {
                                             try FileManager.default.removeItem(atPath: filenamePath)
@@ -136,7 +136,7 @@ class CCloadItemData: NSObject {
                                             let pathExtention = (fileExtArr[fileExtArr.count-1]).uppercased()
                                         
                                             let fileName = "\(dateFormatter.string(from: Date()))\(conuter).\(pathExtention)"
-                                            let filenamePath = directory + "/" + fileName
+                                            let filenamePath = directory + fileName
 
                                             FileManager.default.createFile(atPath: filenamePath, contents:data, attributes:nil)
                                                                                 
@@ -151,7 +151,7 @@ class CCloadItemData: NSObject {
                                             print("item as NSString")
                                         
                                             let fileName = "\(dateFormatter.string(from: Date()))\(conuter).txt"
-                                            let filenamePath = directory + "/" + fileName
+                                            let filenamePath = directory + fileName
                                         
                                             FileManager.default.createFile(atPath: filenamePath, contents:data.data(using: String.Encoding.utf8.rawValue), attributes:nil)
                                         

+ 2 - 1
Share/ShareViewController.m

@@ -228,7 +228,8 @@
         metadataForUpload.status = k_metadataStatusWaitUpload;
         
         // Prepare file and directory
-        [CCUtility copyFileAtPath:[NSTemporaryDirectory() stringByAppendingString:fileName] toPath:[CCUtility getDirectoryProviderStorageFileID:metadataForUpload.fileID fileNameView:fileName]];
+        [CCUtility copyFileAtPath:[NSTemporaryDirectory() stringByAppendingString:[self.filesName objectAtIndex:0]] toPath:[CCUtility getDirectoryProviderStorageFileID:metadataForUpload.fileID fileNameView:fileName]];
+        [self.filesName replaceObjectAtIndex:0 withObject:fileName];
         
         // Add Medtadata for upload
         tableMetadata *metadata = [[NCManageDatabase sharedInstance] addMetadata:metadataForUpload];

+ 1 - 1
iOSClient/Main/Create cloud/NCCreateFormUploadScanDocument.swift

@@ -329,7 +329,7 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate {
             self.present(alertController, animated: true, completion:nil)
             
         } else {
-            dismissAndUpload(fileNameSave, fileID: CCUtility.createMetadataID(fromAccount: appDelegate.activeAccount, serverUrl: serverUrl, fileName: serverUrl, directory: false)!, serverUrl: serverUrl)
+            dismissAndUpload(fileNameSave, fileID: CCUtility.createMetadataID(fromAccount: appDelegate.activeAccount, serverUrl: serverUrl, fileName: fileNameSave, directory: false)!, serverUrl: serverUrl)
         }
     }