Empty List<MultipartFile> when trying to upload many files in Spring with ng-file-upload
<p>I have the following controller method for uploading multiple files at once, inspired by <a href="http://crunchify.com/spring-mvc-tutorial-how-to-upload-multiple-files-to-specific-location/" rel="noreferrer">this blog post</a> and answers to <a href="https://stackoverflow.com/questions/2017807/spring-3-upload-many-files">this question</a> as well:</p>

<pre><code>@RequestMapping(value = "/{user}/attachment", method = RequestMethod.POST)
@PreAuthorize(...)
public void upload(@PathVariable User user, 
                   @RequestParam("file") List&lt;MultipartFile&gt; files) {
  // handle files
}
</code></pre>

<p>However, the list of the files is always empty although request contains them.</p>

<p>If I add the third <a href="http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/web/multipart/MultipartRequest.html" rel="noreferrer"><code>MultipartRequest</code></a> parameter to the method:</p>

<pre><code>public void upload(@PathVariable User user, 
                   @RequestParam("file") List&lt;MultipartFile&gt; files,
                   MultipartRequest request)
</code></pre>

<p>I can see it contains my uploaded files correctly:</p>

<p><img src="https://i.stack.imgur.com/pWTZF.png" alt="request contents"></p>

<p>What might be the reason of empty <code>List&lt;MultipartFile&gt;</code>?</p>

<p>I'm using <a href="https://github.com/danialfarid/ng-file-upload" rel="noreferrer">ng-file-upload</a> to submit the files, but I don't think it is connected with the issue. Spring 4.2.4.</p>