title: Spring mvc: HTTP Status 400 - Required MultipartFile parameter 'file' is not present
body: <p>This is my controller:</p>
  
  <pre><code>@RequestMapping(value = "/admin/users/photo", method = RequestMethod.POST)
  public ModelAndView editUser(@RequestParam("file") MultipartFile file,
                               Principal principal) {
      // code never gets here
  }
  </code></pre>
  
  <p>my mvc-dispatcher-servlet.xml</p>
  
  <pre><code>&lt;bean id="multipartResolver"
        class="org.springframework.web.multipart.support.StandardServletMultipartResolver"&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>pom.xml:</p>
  
  <pre><code>    &lt;dependency&gt;
          &lt;groupId&gt;commons-fileupload&lt;/groupId&gt;
          &lt;artifactId&gt;commons-fileupload&lt;/artifactId&gt;
          &lt;version&gt;1.3.1&lt;/version&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>form itself:</p>
  
  <pre><code>&lt;form action="${pageContext.request.contextPath}"
        method="POST"
        enctype="multipart/form-data"&gt;
          &lt;input type="file"
          name="file"
          /&gt;
      &lt;input type="submit" value="Добавить"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>This is what browser says:</p>
  
  <p><img src="https://i.stack.imgur.com/oO9hJ.png" alt="http 400"></p>
  
  <p>How to fix that? </p>