domy
domy

Reputation: 41

How can upload a zip file into FTP server using swift 3 and iOS 10?

How can upload a zip file into FTP server using swift 3 and iOS 10? I need to do this in my app to send logs files.

Upvotes: 0

Views: 2351

Answers (1)

alessionossa
alessionossa

Reputation: 991

You can use this framework to upload files to an FTP server: https://github.com/Constantine-Fry/rebekka

With this, you just need to set configuration in AppDelegate (like this) and to upload you use this code:

if let URL = NSBundle.main.URL(forResource:"MyLog", withExtension: "zip") {
        let path = "/upload/\(UUID.init().uuidString).zip"
        self.session.upload(URL, path: path) {
            (result, error) -> Void in
            print("Upload file with result:\n\(result), error: \(error)\n\n")
        }
 }

Upvotes: 2

Related Questions