You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, thanks a lot for this useful library, I'm trying to upload an image to an ftp server, the file is being uploaded successfully but it's size is remaining zero KB, can anyone help me please.
`
var ftpProvider: FTPFileProvider?
override func viewDidLoad() {
super.viewDidLoad()
self.uploadPicker.delegate = self
// information
let server: URL = URL(string: "ftp://xxx.xxx.xxx.xxx/")!
let username = "xxxxx"
let password = "xxxxxxx"
let credential = URLCredential(user: username, password: password, persistence: .permanent)
ftpProvider = FTPFileProvider(baseURL: server, mode: FTPFileProvider.Mode.passive, credential: credential, cache: URLCache())
ftpProvider?.delegate = self
}
//when image is picked
func imagePickerController(_ picker: UIImagePickerController,
didFinishPickingMediaWithInfo info: [String : Any]) {
guard let chosenImage = info[UIImagePickerControllerOriginalImage] as? UIImage else{
print("RIZK:- issue in picking images ")
return
}
// save image file
_ = SavingManager.shared.saveImage(image: chosenImage)
// get image url
guard let localURL = SavingManager.shared.getSavedImageURL("fileName.png") else{
return
}
// check that image is not nil
guard let imagePreview = SavingManager.shared.getSavedImage(named: "fileName.png") else{
return
}
// check image size
SavingManager.shared.getFileSize(localURL.path)
print("RIZK:--- file name should be \(DataManager.shared.getArchivedUser()?.lastName ?? "Guest")-\(Int(Date().timeIntervalSince1970))")
let imageName = "\(DataManager.shared.getArchivedUser()?.lastName ?? "Guest")-\(Int(Date().timeIntervalSince1970)).png"
_ = ftpProvider?.copyItem(localFile: localURL, to: "files/\(imageName)", overwrite: true, completionHandler: { (error) in
if error == nil {
print("RIZK:-- Ready to upload")
}else{
print("RIZK:--\(error?.localizedDescription ?? "")")
}
})
self.navigationController?.dismiss(animated:true, completion: nil)
}
`
The text was updated successfully, but these errors were encountered:
Hello, thanks a lot for this useful library, I'm trying to upload an image to an ftp server, the file is being uploaded successfully but it's size is remaining zero KB, can anyone help me please.
`
`
The text was updated successfully, but these errors were encountered: