title: how to upload a file using multipart form data in android
body: <p>How to use the  multipart-form data(@FormDataParamdata) for uploading a file in android. I was trying to upload a image file from android end  with multipart form data. </p>
  
  <pre><code>Here the server script what i found at the server side:
  public Image upload(@FormDataParam("image") InputStream istream,
              @FormDataParam("image") FormDataBodyPart body,
              @FormDataParam("eventId") long eventId,
              @FormDataParam("eventDescription") String eventDescription)
              throws ImageWebServiceException {
  //
  ......
  }
  
  Here the client code what i tried for uploading in android...
  
  Client client = new Client();
  client.addFilter(new HTTPBasicAuthFilter("user123", "******"));
  WebResource webResource = client.resource(url);
  ClientResponse response;
  FormDataMultiPart form = new FormDataMultiPart();
  File file = new File("f:/android.png");
  form.field("eventId", "1");
  form.field("eventDescription", "password");
  form.field("image", file.getName());
  form.bodyPart(new FileDataBodyPart("image", file, MediaType.valueOf("image/png")));
  response  = webResource.type(MediaType.MULTIPART_FORM_DATA).post(ClientResponse.class, form);
  
  For the above code im getting the 415 status code error unsupported media type.
  
  
  Thanks.
  </code></pre>