How to send image file via Alamofire? <p>I want to send an image to the server and I'm using this code:</p> <pre><code>Alamofire.upload( .POST, "https://api.mysite.com/image", multipartFormData: { multipartFormData in if let _ = image { if let imageData = UIImageJPEGRepresentation(image!, 1.0) { multipartFormData.appendBodyPart(data: imageData, name: "file", fileName: "file.png", mimeType: "image/png") } } }, encodingCompletion: { encodingResult in switch encodingResult { case .Success(let upload, _, _): upload.responseJSON { response in switch response.result { case .Success: debugPrint(response) case .Failure(let error): print(error) } } case .Failure(let encodingError): print(encodingError) } } ) </code></pre> <p>but in response I get:</p> <pre><code>[Result]: SUCCESS: ( "", { file = { error = 1; name = "file.png"; size = 0; "tmp_name" = ""; type = ""; }; </code></pre> <p>so my file is not sending to the server. What is the wrong in my code?</p>