title: Spring boot @restcontroller upload error
body: <p>I am new to spring boot and android development. I'm trying to set up and android app (using retrofit and okhttp3) which will upload images to my server. </p>
  
  <p>Server code:</p>
  
  <pre><code>@RestController
  public class ImageController {
      @RequestMapping(value = "/uploadImage", method =RequestMethod.POST, consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
      public String greeting(@RequestPart(value="desc") RequestBody desc, @RequestPart(value="img") MultipartBody.Part image) {
          System.out.println("Works");
          return "Works";
      }
  }
  </code></pre>
  
  <p>Android code:</p>
  
  <pre><code>MultipartBody.Part fileToUpload = MultipartBody.Part.createFormData("file", imageFile.getName(), requestBody);
  RequestBody name = RequestBody.create(MediaType.parse("text/plain"), imageFile.getName());
  
  
  @Multipart
  @POST("/uploadImage")
  Observable&lt;retrofit2.Response&lt;String&gt;&gt; uploadPhoto(@Part("desc") RequestBody desc,@Part MultipartBody.Part image);
  </code></pre>
  
  <p>Error:</p>
  
  <blockquote>
    <p>{"timestamp":1519756785858,"status":415,"error":"Unsupported Media Type","exception":"org.springframework.web.HttpMediaTypeNotSupportedException","message":"Content type 'text/plain;charset=utf-8' not supported","path":"/uploadImage"}</p>
  </blockquote>
  
  <p>Can someone tell me what I'm doing wrong????</p>