title: How to upload image as a parameter, with other parameters using multipart form data in ios, swift3, Alamofire 4
body: <p>I'm using <code>Alamofire 4 with swift 3</code> to update user profile. and also I'm using <code>Router</code> class. What I need is to <code>uplaod</code> and image with other parameters. I can <code>update</code> users detail, without uploading the image part.</p>
  
  <p>this is what it looks like in <code>postman</code></p>
  
  <p><a href="https://i.stack.imgur.com/NW3KU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NW3KU.png" alt="enter image description here"></a></p>
  
  <p>so is it possible create an urlconvertible request for this . how can I upload the image with other parametes. (this works fine in postman). how can I do this with new <code>Alamofire</code>. I tried it like below.</p>
  
  <pre><code>let parameters = [
              "profile_image": "swift_file.jpeg"
          ]
  
  
          Alamofire.upload(multipartFormData: { (multipartFormData) in
              multipartFormData.append(UIImageJPEGRepresentation(profileImage, 1)!, withName: "file", fileName: "swift_file.jpeg", mimeType: "image/png")
              for (key, value) in parameters {
                  multipartFormData.append(value.data(using: String.Encoding.utf8)!, withName: key)
              }
          }, to:urltoUpdate)
          { (result) in
              switch result {
              case .success(let upload, _, _):
                  print("the status code is :")
  
                  upload.uploadProgress(closure: { (progress) in
                      print("something")
                  })
  
                  upload.responseJSON { 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
              }
          }
  </code></pre>
  
  <p>but this didn't work properly. hope your help with this part.</p>