title: Uploading files Kotlin Spring Boot
body: <p>So, I am trying to make and upload file(s) functionality, from some blog posts and stackoverflow questions I got this solution:</p>
  <pre><code>@PostMapping(&quot;/file/upload&quot;)
  fun handleFileUpload(
      @RequestParam(&quot;files&quot;) files: List&lt;MultipartFile&gt;?,
  ): String {
      if(files == null) {
          return &quot;File is null&quot;
      }
      // SOME LOGIC
      return &quot;All Good it seems&quot;
  }
  </code></pre>
  <p>But when I send request trough postman I my files are null, here is postman request:
  <a href="https://i.stack.imgur.com/qvmgq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qvmgq.png" alt="Postman" /></a></p>
  <p>I saw some some solutions that use <code>@RequestPart</code> instead of <code>@RequestParam</code>, but when I go down that path, I get <code>unsupported media type</code> response.</p>
  <p>PS: I use Java 11 and Spring Boot 2.6</p>
  <p><strong>UPDATE:</strong>
  Applied suggestions from comments and ended up with this code:</p>
  <pre><code>@PostMapping(&quot;/file/upload&quot;, consumes = [MediaType.MULTIPART_FORM_DATA_VALUE])
  fun handleFileUpload(
      @RequestPart(&quot;files&quot;) files: List&lt;MultipartFile&gt;?,
  ): String {
      //SOME CODE
  }
  </code></pre>
  <p>When I send request trough postman I get <code>415 Unsupported Media Type</code></p>