title: MissingServletRequestParameterException
body: <p>I'm passing a formData object to my Spring back-end:</p>
  
  <pre><code>imageBanner(banner: File, bannerPath: string, id: number, callback: (response) =&gt; void){
      var formData = new FormData();
      formData.append('name', banner.name);
      console.log(formData.get('name'));
      formData.append('file', banner);
      console.log(formData.get('file'));
  
      this.sendPost("/upload/" + bannerPath, formData, response =&gt; {
          callback(response);
      });
  
  }
  </code></pre>
  
  <p>The console log shows:</p>
  
  <pre><code>1.jpg 
  File {name: "1.jpg", lastModified: 1496737372408, lastModifiedDate: Tue Jun 06 2017 10:22:52 GMT+0200 (W. Europe Daylight Time), webkitRelativePath: "", size: 38983…}
  </code></pre>
  
  <p>So it looks like the formData has some values.</p>
  
  <p>In the back-end I have this:</p>
  
  <pre><code>@RequestMapping(value="/rest/upload/localeventbanner", method=RequestMethod.POST, headers = "content-type!=multipart/form-data")
      public @ResponseBody String uploadFileHandler(@RequestParam("name") String name, @RequestParam("file") MultipartFile file) {
  
      if (!file.isEmpty()) {
          try {
              log("success");
  
              return "You successfully uploaded file=" + name;
          } catch (Exception e) {
              log("fail");
              return "You failed to upload";
          }
      } else {
          log("nope");
          return "You failed to upload " + name
                  + " because the file was empty.";
      }
  }
  </code></pre>
  
  <p>The return I'm getting in the console is:</p>
  
  <blockquote>
    <p>"{"timestamp":1502745177167,"status":400,"error":"Bad Request","exception":"org.springframework.web.bind.MissingServletRequestParameterException","message":"Required String parameter 'name' is not present","path":"/beheerback/rest/upload/localeventbanner"}"</p>
  </blockquote>
  
  <p>It says name isn't present but when I log it in the front-end it shows name is present in the formData object.</p>