Q: Ambiguous reference to member 'upload(_:_:headers:file:)' The code below works perfectly in Swift 3 to upload an image file as multipart. However, I haven't been able to get anything similar to work in Swift 2.2. If I try to use this in Swift 2.2, I get the message Ambiguous reference to member 'upload(_:_:headers:file:)'
Is there a way to accomplish the same thing in Swift 2.2? I have found several related questions, but have only found solutions that work in Swift 3.
func submitFile(entryId: Int, entryDetailValue: String, fieldId: Int, fieldType: String) {

    let parameters = [
        "entryId": "\(entryId)",
        "entryDetail": entryDetailValue,
        "fieldId": "\(fieldId)",
        "type": fieldType
    ]

    print(parameters)

    Alamofire.upload(multipartFormData: { (multipartFormData) in
        multipartFormData.append(UIImageJPEGRepresentation(self.imageView.image!, 1)!, withName: "file", fileName: "swift_file.jpeg", mimeType: "image/jpeg")
        for (key, value) in parameters {
            multipartFormData.append(value.data(using: String.Encoding.utf8)!, withName: key)
        }
        }, to:"<my endpoint url>")
    { (result) in
        switch result {
        case .success(let upload, _, _):

            upload.uploadProgress(closure: { (progress) in
                //Print progress
                print(progress)
            })

            upload.responseData { response in
                print(response.result)
            }

        case .failure(let error):
            print(error)
        }
    }

}


A: In swift 3 try this 
func uploadImageWithParameter()
{
    let id = String(describing: userDefaults.value(forKey: USER_LOGIN_ID)!)

    var parameters = [String:String]()
    parameters = ["title":headingTextfield.text!,
                  "id":id,
                  "description":descriptionTextview.text,
                  "author":authorTextfield.text!,
                  "url": urlTextfield.text!]

    Alamofire.upload(multipartFormData: { (multipartFormData) in
        multipartFormData.append(UIImageJPEGRepresentation(self.capturedImage, 0.5)!, withName: "pic", fileName: "swift_file.jpeg", mimeType: "image/jpeg")
        for (key, value) in parameters {
            multipartFormData.append(value.data(using: String.Encoding.utf8)!, withName: key)
        }

    }, to:"your url")
    { (result) in
        switch result {
        case .success(let upload, _, _):

            upload.uploadProgress(closure: { (Progress) in
                print("Upload Progress: \(Progress.fractionCompleted)")
            })

            upload.responseJSON { response in
                //self.delegate?.showSuccessAlert()
                print(response.request)  // original URL request
                print(response.response) // URL response
                print(response.data)     // server data
                print(response.result)   // result of response serialization
                //                        self.showSuccesAlert()
                //self.removeImage("frame", fileExtension: "txt")
                if let JSON = response.result.value {
                    print("JSON: \(JSON)")
                }
            }

        case .failure(let encodingError):
            //self.delegate?.showFailAlert()
            print(encodingError)
        }

    }
}

