     }
 
     // swiftlint:disable:next function_parameter_count
-    func uploadPhoto(sftpSession: NMSFTP, imageData: NSData, info: NSDictionary, index: Int, totalNumber: Int, creationDate: NSDate) -> String? {
-        let uniqueFilename = getUniqueFilename(creationDate, imageData: imageData)
-
-        // swiftlint:disable:next force_cast
-        let originalFilePathURL = info.valueForKey("PHImageFileURLKey") as! NSURL
-        let originalFilePathString = originalFilePathURL.absoluteString
+    func uploadFile(sftpSession: NMSFTP, fileData: NSData, originalURL: NSURL, index: Int, totalNumber: Int, creationDate: NSDate) -> String? {
+        let uniqueFilename = getUniqueFilename(creationDate, fileData: fileData)
+
+        let originalFilePathString = originalURL.absoluteString
         NSLog("Original file path is " + originalFilePathString)
 
-        var originalFileExtension = originalFilePathURL.pathExtension
-
+        var originalFileExtension = originalURL.pathExtension
         originalFileExtension = (originalFileExtension == nil) ? "" : "." + originalFileExtension!
+        NSLog("Original file extension is " + originalFileExtension!)
 
         let finalFileName = uniqueFilename + originalFileExtension!
         let finalFilePath =  self.remoteDir.text! + "/" + finalFileName
         let tempFilePath = self.remoteDir.text! + "/.tmp" + originalFileExtension!
-
-        let localFileLength = imageData.length
+        NSLog("Final file path is " + finalFilePath)
+        NSLog("Temp file path is " + tempFilePath)
+
+        let localFileLength = fileData.length
 
         if sftpSession.fileExistsAtPath(finalFilePath) &&
             sftpSession.infoForFileAtPath(finalFilePath).fileSize == localFileLength &&

        }
    }

    func getUniqueFilename(date: NSDate, imageData: NSData) -> String {
        let dateFormatter = NSDateFormatter()
        let enUSPosixLocale = NSLocale(localeIdentifier: "en_US_POSIX")
        dateFormatter.locale = enUSPosixLocale
        dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZZZZZ"
        let formattedDate = dateFormatter.stringFromDate(date)

        let hash = imageData.crc32()

        return formattedDate + "_" + hash!.toHexString()
    }

            if sftpSession != nil {
                var filesToBeKept = Set<String>()

                for asset in photoAssets {
                    counter += 1

                    // swiftlint:disable:next force_cast
