title: okhttp multipart image upload with file name
body: <p>i am trying to upload a image to server from an android phone. this is what i have done so far</p>
  
  <pre><code>  OkHttpClient client = new OkHttpClient();
              MultipartBuilder builder = new MultipartBuilder();
  
  
  builder.type(MultipartBuilder.FORM).addPart(RequestBody.create(MediaType.parse("application/json; charset=utf-8"), requestPackage.getJsonParam().toString()));
              for (int i = 0; i &lt; requestPackage.getPics().size(); i++) {
                  builder.addPart(RequestBody.create(MediaType.parse("image/png"/* + i*/), new File(URI.create(requestPackage.getPics().get(i)))));
              Log.i("image to upload",URI.create(requestPackage.getPics().get(i)).toString());
              }
              requestBody = builder.build();
       Request request = new Request.Builder().url(requestPackage.getUri()).post(requestBody).build();
              try {
                  response = client.newCall(request).execute();
                  if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
      //            System.out.println(response.body().string());
                  return response.body().string();
              } catch (IOException e) {
                  e.printStackTrace();
              }
  </code></pre>
  
  <p>how do i add names to the different parts.because if there is no name(key) to them then how will server side guy store it?</p>