title: Upload MultiPart file from Android to server(SpringMVC)
body: <p>If, I'm using Postmam file upload without problems. But, when anroid tries upload file in server, method throws NPE, becouse MultipartFile file = null. </p>
  
  <p><strong>Android</strong></p>
  
  <pre><code>RequestBody requestBody = RequestBody.create(MediaType.parse("image/*"), file);
  
  Call&lt;MediaResponseModel&gt; call = service.uploadImage(requestBody);
  
  call.enqueue(new RetrofitCallback&lt;&gt;(callback));
  
  
  @POST("/uploadImage")
  
  Call&lt;MediaResponseModel&gt; uploadImage(@Part("file") RequestBody file);
  </code></pre>
  
  <p><strong>Server</strong></p>
  
  <pre><code>@RequestMapping(value = "/uploadImage", method = RequestMethod.POST)
  @ResponseBody
  public ResponseEntity&lt;?&gt; imageUpload(@RequestHeader(value = "id") String sessionId,
                                        @RequestParam (value = "file")   MultipartFile file)
  </code></pre>
  
  <p><em>ApplicationContext</em></p>
  
  <pre><code> &lt;bean id="jsonConverter"
        class="org.springframework.http.converter.json.GsonHttpMessageConverter"&gt;
      &lt;property name="supportedMediaTypes"&gt;
          &lt;list&gt;
              &lt;value&gt;application/json;charset=UTF-8&lt;/value&gt;
          &lt;/list&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  
  &lt;mvc:annotation-driven &gt;
  &lt;mvc:message-converters&gt;
      &lt;bean class="org.springframework.http.converter.json.GsonHttpMessageConverter"/&gt;
  &lt;/mvc:message-converters&gt;
  &lt;/mvc:annotation-driven&gt;
  </code></pre>