title: Upload Multiple images using Volley Library in android
body: <p>I have tried to upload multiple images using <code>volley library</code> in a single <code>web service</code>. but, only the last image is getting uploaded. Those previous images are getting replaced with the null. I want to know is it possible with volley library, if not can you plz suggest me other libraries. I'm a newbie to android I only know volley for uploading images.</p>
  
  <p>//JSON Request  </p>
  
  <pre><code>public MySampleImageUpload() {
      JSONRequestResponse mResponse = new JSONRequestResponse(mContext);
  
      Bundle parms = new Bundle();
      parms.putString("key_meail", "rojesh@demo.com");
      parms.setFile("key_url", image_path);
  
      mResponse.getResponse("sample_upload_data_url", REQUEST_CODE, this,
              parms);
  
  }
  </code></pre>
  
  <p>// In SetFile &amp; getResponse code</p>
  
  <pre><code>package com.fartogram.utils;
  
  import java.io.File;
  
  import org.json.JSONObject;
  
  import android.content.Context;
  import android.os.Bundle;
  
  import com.android.volley.Request;
  import com.android.volley.Response;
  import com.android.volley.VolleyError;
  import com.android.volley.examples.toolbox.MultipartRequest;
  import com.android.volley.examples.toolbox.MyVolley;
  import com.android.volley.toolbox.JsonObjectRequest;
  
      public class JSONRequestResponse {
  
          public JSONRequestResponse(Context cntx) {
              mContext = cntx;
          }
  
          private final Context mContext;
          private int reqCode;
          private IParseListener listner;
  
          private boolean isFile = false;
          private String file_path = "", key = "";
  
          public void getResponse(String url, final int requestCode,
                  IParseListener mParseListener) {
              getResponse(url, requestCode, mParseListener, null);
          }
  
          public void getResponse(String url, final int requestCode,
                  IParseListener mParseListener, Bundle params) {
              this.listner = mParseListener;
              this.reqCode = requestCode;
  
              Response.Listener&lt;JSONObject&gt; sListener = new Response.Listener&lt;JSONObject&gt;() {
                  @Override
                  public void onResponse(JSONObject response) {
                      if (listner != null) {
                          listner.SuccessResponse(response, reqCode);
                      }
                  }
              };
  
              Response.ErrorListener eListener = new Response.ErrorListener() {
                  @Override
                  public void onErrorResponse(VolleyError error) {
                      if (listner != null) {
                          listner.ErrorResponse(error, reqCode);
                      }
                  }
              };
  
              if (!isFile) {
                  JsonObjectRequest jsObjRequest = new JsonObjectRequest(
                      Request.Method.GET, url, null, sListener, 
  
  eListener);
                  MyVolley.getRequestQueue().add(jsObjRequest);
              } else {
                      if (file_path != null) {
                          File mFile = new File(file_path);
                          MultipartRequest multipartRequest = 
          new MultipartRequest(url,eListener, sListener, key, mFile, params);
                      MyVolley.getRequestQueue().add(multipartRequest);
                  } 
              }
          }
  
          public boolean isFile() {
              return isFile;
          }
  
  
          public void setFile(String param, String path) {
              if (path != null &amp;&amp; param != null) {
                  key = param;
                  file_path = path;
                  this.isFile = true;
              }
          }
  
      }
  </code></pre>