upload image to server using Alamofire
<p>this is my code that I want to upload image to server using <a href="http://github.com/alamofire/alamofire" rel="noreferrer">Alamofire</a>, it not error but it can't push image to server. what should I do?</p>

<pre><code>let url = URL(string: urlString)!
var urlRequest = URLRequest(url: url)
urlRequest.httpMethod = "POST"

let parameters = ["name": rname]

do {
    urlRequest.httpBody = try JSONSerialization.data(withJSONObject: parameters, options: [])
} catch {
    print(error)
}

urlRequest.setValue("application/json", forHTTPHeaderField: "Content-Type")
    let image = UIImage.init(named: "myImage")
    let imgData = UIImageJPEGRepresentation(image!, 0.2)!


Alamofire.upload(multipartFormData: { MultipartFormData in

        MultipartFormData.append(imgData, withName: "fileset", fileName: "name", mimeType: "image/jpg")


    },with: urlRequest,encodingCompletion: { encodingResult in

        switch encodingResult {

        case .success(let upload, _, _):

            upload.responseJSON { response in

                if let info = response.result.value as? Dictionary&lt;String, AnyObject&gt; {

                    if let links = info["links"] as? Dictionary&lt;String, AnyObject&gt; {

                        if let imgLink = links["image_link"] as? String {
                            print("LINK: \(imgLink)")
                        }
                    }
                }

            } case .failure(let error):
                print(error)
        }
    })
</code></pre>