title: Upload multipart/form-data file in Spring boot and REST API
body: <p>I want to upload a .png file and storage that.when I send it with content-type=multipart/form-data I receive this Exception</p>
  
  <pre><code>org.springframework.web.HttpMediaTypeNotSupportedException: Content type 
    'application/octet-stream' not supported . 
  </code></pre>
  
  <p>I think my application doesn't understand form-data contentType and throws an irrelevant exception. What's wrong?</p>
  
  <pre class="lang-java prettyprint-override"><code>    @Controller
      public class ProfileController {
          private static final Logger logger = LoggerFactory.getLogger(ProfileController.class);
  
          @Autowired
          ProfileService service;
  
          //http : http --pretty all --form PUT localhost:8080/profile/v1?thumb=glb
          @PutMapping(value = "/v1")
          public Mono&lt;ResponseEntity&lt;String&gt;&gt; upload(@RequestPart(value = "thumb", required = false) String thumbFilterName,
                                                     @RequestPart(value = "genthumb", required = false) String genthumb,
                                                     @RequestPart("hash") String hash,
                                                     @RequestPart("uploader") Long uploader,
                                                     @RequestPart("file") MultipartFile file) throws Exception {
  
  
          System.out.println(thumbFilterName);
          System.out.println(gentumb);
          System.out.println(uploader);
          System.out.println(file);
  //and doing storage stuff!
  return Mono.just(ResponseEntity.ok().build());
          }
      }
  </code></pre>
  
  <p>and this is my Rest Client that is used for sending file. Pay attention to response.</p>
  
  <p>These are screenshots of restClient. Sending file with restClient:</p>
  
  <p><img src="https://i.stack.imgur.com/266WU.png" alt="sending file with restClient"></p>
  
  <p>And this is setting headers</p>
  
  <p><img src="https://i.stack.imgur.com/6uWEj.png" alt="and this is setting headers"></p>