title: RestTemplate upload image as MultipartFile with Content-Type image/jpg
body: <p>I am trying to upload an image (MultipartFile) using RestTemplate to a server URL.
  Sending request from postman works with <code>Content-Type: image/jpg</code> and an image sent as Binary File from Body.</p>
  
  <p>Method implementation in SpringBoot:</p>
  
  <pre><code>public ResponseEntity&lt;String&gt; uploadImage(MultipartFile file) {
      restTemplate.getMessageConverters().add(new ByteArrayHttpMessageConverter());
      restTemplate.getMessageConverters().add(new BufferedImageHttpMessageConverter());
  
      LinkedMultiValueMap&lt;String,Object&gt; params = new LinkedMultiValueMap&lt;&gt;();
      params.add("file", new FileSystemResource(file));
      HttpHeaders httpHeaders = new HttpHeaders();
      httpHeaders.setContentType(MediaType.IMAGE_JPEG);
      HttpEntity&lt;LinkedMultiValueMap&lt;String, Object&gt;&gt; requestEntity = new HttpEntity&lt;&gt;(params, httpHeaders);
  
      return restTemplate.exchange(UPLOAD_URL, HttpMethod.POST, requestEntity, String.class);
  </code></pre>
  
  <p>Exception:</p>
  
  <pre><code>org.springframework.web.client.RestClientException: Could not write request: no suitable HttpMessageConverter found for request type [org.springframework.util.LinkedMultiValueMap] and content type [image/jpeg]
  </code></pre>
  
  <p>Upload works with Content-Type <code>MediaType.MULTIPART_FORM_DATA</code> but REST Service that I use only accepts <code>image/jpg</code> as HTTP Content-Type.</p>
  
  <p>Thanks.</p>