title: send multipart images with volley and horizontal progress bar
body: <p>I want to upload images via volley using multipart and also want to show progress dialog during image upload.</p>
  
  <p>I am use <a href="http://toolongdidntread.com/android/android-multipart-post-with-progress-bar/" rel="nofollow noreferrer">this code for show progress dialog</a> when images are upload and also <a href="https://stackoverflow.com/questions/16797468/how-to-send-a-multipart-form-data-post-in-android-with-volley">check this code for this.</a></p>
  
  <p>and use below code for upload.</p>
  
  <pre><code>public void doFileUpload(ArrayList&lt;MyUploadImage&gt; images){
          try {
              //MultipartEntityBuilder entityBuilder = MultipartEntityBuilder.create();
              //entityBuilder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
  
              JSONObject jo = new JSONObject();
              jo.put("NoOfImages", images.size());
  
              HttpClient client = new DefaultHttpClient();
              HttpPost post = new HttpPost(link);
  
              CustomMultiPartEntity multipartContent = new CustomMultiPartEntity(new ProgressListener()
              {
                  @Override
                  public void transferred(long num)
                  {
                      pd.setProgress((int) ((num / (float) totalSize) * 100));
                  }
              });
  
              //MultipartEntity reqEntity = new MultipartEntity();
              int size = images.size();
              for(int i = 0; i &lt; size; i++){
                  FileBody bin1 = new FileBody(images.get(i).getImageFile());
  
                  multipartContent.addPart(("uploaded_file"+i), bin1);
              }
  
              multipartContent.addPart("girish", new StringBody(jo.toString()));
              totalSize = multipartContent.getContentLength();
  
              post.setEntity(multipartContent);
              HttpResponse response = client.execute(post);
  
              HttpEntity resEntity = response.getEntity();
  
              final String response_str = EntityUtils.toString(resEntity);
  
              Log.e("Response", response_str);
  
              pd.dismiss();
          } catch (ClientProtocolException e) {
              e.printStackTrace();
              pd.dismiss();
          } catch (Exception e) {
              e.printStackTrace();
              pd.dismiss();
          }
  
      }
  </code></pre>
  
  <p>Thanks</p>