title: from andriod i am trying to upload image and i am using web services in java
body: <p>below is the android part</p>
  
  <pre><code>new MultipartUploadRequest(this,uploadid,UPLOAD_URL)
                  .addFileToUpload(path,"image")
                  .addParameter("name",name)
                  .setNotificationConfig(new UploadNotificationConfig())
                  .setMaxRetries(2)
                  .startUpload();
  </code></pre>
  
  <p>below is my java controller in web services </p>
  
  <pre><code>@RequestMapping(value = "/uploadm",method=RequestMethod.POST)
  public void submitQuestionuploading(@RequestBody String image) throws Exception 
  {   
      System.out.println(1+""+image);
  
  
  
          try {
  
  
               byte[] bytes = image.getBytes();
               System.out.println(11);
               BufferedOutputStream stream =new BufferedOutputStream(new 
               FileOutputStream(new File(UPLOAD_DIRECTORY +"11.png")));  
               stream.write(bytes);  
               stream.flush();  
               stream.close();
            } 
                catch (Exception e) {
              System.out.println(e);
  
      } 
  </code></pre>
  
  <p>output is this one i got in console but file is created but it is corrupted and it s  size 0bytes ,</p>
  
  <blockquote>
    <p>---------AndroidUploadService1518510071115 Content-Disposition: form-data; name="image"; filename="IMG_20180211_000033.jpg"
    Content-Type: image/jpeg</p>
    
    <p>ÿØÿá3ØExif</p>
  </blockquote>
  
  <p>i tried to put this in java controller but it is not working    </p>
  
  <blockquote>
    <p>@RequestMapping(value = "/upload", method = RequestMethod.POST ,
    headers = "Content-Type=multipart/form-data")     public String
    fileUpload(@RequestParam("image") CommonsMultipartFile file) {}</p>
  </blockquote>
  
  <p>but i want to do in spring <code>MVC</code> only, help me to take uploaded file</p>