title: Spring Rest - Post multiple files
body: <p>Using Spring Boot 2.1.8, I have two methods in a Rest Controller that expect a single file and multiple files respectively. These are the method signatures:</p>
  
  <pre><code>@PreAuthorize("hasAnyRole('ROLE_ADMIN')")
  @PostMapping("/uploadMultipleFiles")
      public List&lt;FileResponse&gt; uploadMultipleFiles(@RequestParam("files") MultipartFile[] files);
  
  @PreAuthorize("hasAnyRole('ROLE_ADMIN')")
  @PostMapping("/upload")
  public FileResponse uploadFile(@RequestParam("file") MultipartFile file);
  </code></pre>
  
  <p>The single upload works just perfect. I am managing to load a single file from a web client, Postman v7.25.0, and from Swagger 2.</p>
  
  <p>But the multiple file method only works when uploading files from Postman, returning a 400 http error code. Therefore, it does not even enter the method.</p>
  
  <p>The error message in both cases (web client or Swagger) is the same: </p>
  
  <pre><code>can't parse JSON.  Raw result:
  Missing or unreadable multipart file in request
  </code></pre>
  
  <p>This is the request headers when calling to /uploadMultipleFiles through Swagger (getting error):
  <a href="https://i.stack.imgur.com/3MC1G.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3MC1G.png" alt="enter image description here"></a></p>
  
  <p>This is the request headers when calling /uploadMultipleFiles from Postman (works fine):
  <a href="https://i.stack.imgur.com/i427g.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/i427g.png" alt="enter image description here"></a></p>
  
  <p>This is the request headers when calling /upload from Postman (works fine):
  <a href="https://i.stack.imgur.com/YsABV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YsABV.png" alt="enter image description here"></a></p>
  
  <p>This is the request headers when calling /upload through Swagger (works fine):
  <a href="https://i.stack.imgur.com/5F7wZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5F7wZ.png" alt="enter image description here"></a></p>
  
  <p>Firstly I thought that Content-Type might have something to do with my problem. But Swagger sends always application/json, and it works with the single upload endpoint.</p>
  
  <p>Any idea?</p>