Closed MuneebSaeed4 closed 7 years ago
Hello!, i found this solution http://stackoverflow.com/questions/34335867/upload-file-to-ftp-server-with-swift use this code to solve your problem
let file = "myFile.txt"
if let dir : NSString = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.AllDomainsMask, true).first {
//path will be stored here
let sPath = dir.stringByAppendingPathComponent(file);
print(sPath) // printing the file path
let url: NSURL = NSURL(string: sPath)!
let destinationFile = "myFile.txt"
FTPSession.upload(url, path: destinationFile) { // <-- Dies here
(result, error) -> Void in
print("- Result:\n\(result), error: \(error)\n\n")
}
}
All credits to O-mkar
I will close the issue since it's old and seems to be resolved.
There is a problem while uploading Image from Gallery.
Always returning nil I saved an image in Directory "getImagePath"
I tried to give direct path of image but error still exists.. also tried "URLForResource" but no use. Kindlly resolve my issue please. P.S i am trying on Simulator