trying to upload image to the server using Alamofire Swift 4

I'm new with swift please explain to me What is the wrong in my code ? I just make copy and paste from another website but it's not woks fine

@IBAction func startUploadClicked(_ sender: UIButton) {


      let image = theImage.image
    let imageData = convertImageToBase64(image: image!)



    let headers = [
        "SecurityToken": UserDefaults.standard.string(forKey: "SecurityToken")!,
        "api_key": "Ml3BHS17tJ89Y3Tf4Qdsge"        ]

    let parameters = [
        "Id":"\(16)",
        "FileName":"image.jpg",
        "ImageData":"\(imageData)"
    ]

    Alamofire.upload(multipartFormData: { (multipartFormData) in

        multipartFormData.append(UIImageJPEGRepresentation(image!, 1)!, withName: "profile_image", fileName: "swift_file.jpeg", mimeType: "image/png")

        for (key, value) in parameters {
            multipartFormData.append(value.data(using: String.Encoding.utf8)!, withName: key)
        }

    }, usingThreshold:UInt64.init(),
       to: "https://www.theserver.com", //URL Here
        method: .post,
        headers: headers, //pass header dictionary here
        encodingCompletion: { (result) in
            // switch the result output 
            switch result {
            case .success(let upload, _, _):
                print("the status code is :")

                upload.uploadProgress(closure: { (progress) in
                    print("something")
                })

                upload.responseString { response in
                    print("the resopnse code is : \(response.response?.statusCode)")
                    print("the response is : \(response)")
                }
                break
            case .failure(let encodingError):
                print("the error is  : \(encodingError.localizedDescription)")
                break
            }
    })

}

the error is printed after this line

print("the resopnse code is : \(response.response?.statusCode)")

optional(404)

but the result of the following line is success

print("the response is : \(response)")

can anybody help me to solve that ?!

the new error in the command is

[Data]: 1245 bytes [Result]: FAILURE: responseSerializationFailed(reason: Alamofire.AFError.ResponseSerializationFailureReason.jsonSerializationFailed(error: Error Domain=NSCocoaErrorDomain Code=3840 "Invalid value around character 0." UserInfo={NSDebugDescription=Invalid value around character 0.}))