title: Unable to convert ByteArrayResource to Multipart file in Java
body: <p>I am trying to send Multipart file using Rest api. The catch is before sending the file I am zipping the content and adding it to HttpEntity. So when it reaches to the endpoint, the Multipart is unable to parse it and giving an exception.</p>
  
  <p>MissingServletRequestPartException","message":"Required request part 'file' is not present".</p>
  
  <p>Need help to solve this problem.</p>
  
  <pre><code>public void sendRecord(final byte[] compressedRecord) {
  
             final MultiValueMap&lt;String, Object&gt; multipartReq = new LinkedMultiValueMap&lt;&gt;();
  
             {
                  final HttpHeaders zipHdr = new HttpHeaders();
                  zipHdr.setContentType(MediaType.APPLICATION_OCTET_STREAM);
                  final HttpEntity&lt;ByteArrayResource&gt; entity = new HttpEntity&lt;&gt;(new ByteArrayResource(compressedRecord), zipHdr);
                  multipartReq.add(AppConstants.MULTIPART_FILE_LABEL, entity);
                  log.info("multipartReq {}", multipartRequest);
              }
  
              final HttpHeaders headers = new HttpHeaders();
              headers.setContentType(MediaType.MULTIPART_FORM_DATA);
              headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
              headers.setAcceptCharset(Collections.singletonList(StandardCharsets.UTF_8));
  
              final HttpEntity&lt;MultiValueMap&lt;String, Object&gt;&gt; requestEntity = new HttpEntity&lt;&gt;(multipartRequest, headers);
              this.retryableRestOperations.exchange(this.url, HttpMethod.PUT, requestEntity, Void.class);
  }
  </code></pre>