title: Uploading file with other parameters in spring controller
body: <p>I am unable to send the multipart file and two text fields from angular post request to spring controller.</p>
  
  <p>My post request is like follows,</p>
  
  <pre><code>$scope.data = {
              "file": $scope.uploadFile,
              "doucmentType" : $scope.documentType,
              "otherDocumentType" : $scope.otherDocumentType
      }
  </code></pre>
  
  <p>where $scope.uploadFile is the file object, doucmnetType and otherDocumentType are two text fields that I wish to send to spring controller with the file.</p>
  
  <p>The post request is as follows,</p>
  
  <pre><code>$http.post(appPath + '/temp/uploadAttachments',JSON.stringify($scope.data) ).success(function(result) {
  
      });
  </code></pre>
  
  <p>My spring controller is as follows,</p>
  
  <pre><code>@RequestMapping(value = "uploadAttachments", method = RequestMethod.POST)
  @ResponseBody
  public String uploadAttachments(@RequestBody ReqParam reqParam) {
  
      JSONObject ret= new JSONObject();
      ret.put("result", true);
      return ret.toString();
  
  }
  </code></pre>
  
  <p>Where ReqParam is pojo class containing the getters and setters of the file with other fields like,</p>
  
  <pre><code>private MultipartFile file;
  
  private String doucmentType;
  
  private String otherDocumentType;
  
  public String getOtherDocumentType() {
      return otherDocumentType;
  }
  
  public void setOtherDocumentType(String otherDocumentType) {
      this.otherDocumentType = otherDocumentType;
  }
  
  public String getDoucmentType() {
      return doucmentType;
  }
  
  public void setDoucmentType(String doucmentType) {
      this.doucmentType = doucmentType;
  }
  
  public MultipartFile getFile() {
      return file;
  }
  
  public void setFile(MultipartFile file) {
      this.file = file;
  }
  </code></pre>
  
  <p>Thanks</p>