|
@@ -87,10 +87,19 @@ class CCloadItemData: NSObject {
|
|
|
|
|
|
print("item as url: \(String(describing: item))")
|
|
|
|
|
|
- let pathExtention = URL(fileURLWithPath: url.lastPathComponent).pathExtension
|
|
|
- let fileName = "\(dateFormatter.string(from: Date()))\(conuter).\(pathExtention)"
|
|
|
+ let fileName = url.lastPathComponent
|
|
|
+ // OLD fileName with date
|
|
|
+ //let pathExtention = URL(fileURLWithPath: url.lastPathComponent).pathExtension
|
|
|
+ //let fileName = "\(dateFormatter.string(from: Date()))\(conuter).\(pathExtention)"
|
|
|
let filenamePath = directoryUser + "/" + fileName
|
|
|
|
|
|
+ do {
|
|
|
+ try FileManager.default.removeItem(atPath: filenamePath)
|
|
|
+ }
|
|
|
+ catch let error as NSError {
|
|
|
+ print("Ooops! Something went wrong: \(error)")
|
|
|
+ }
|
|
|
+
|
|
|
do {
|
|
|
try FileManager.default.copyItem(atPath: url.path, toPath:filenamePath)
|
|
|
|