title: How to upload Image on server using Volley?
body: <p>I'm trying to post my data using <strong>Volley</strong> but my i'm not able to upload my image on server. Always getting error like unexpected response code 500 for <code>http:\\www.mybaseurl.com/upload.php</code>. 
  Following is my code by which i'm trying to upload</p>
  
  <pre><code> public String getStringImage(Bitmap bmp){
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      bmp.compress(Bitmap.CompressFormat.JPEG, 100, baos);
      byte[] imageBytes = baos.toByteArray();
      String encodedImage = Base64.encodeToString(imageBytes, Base64.DEFAULT);
      return encodedImage;
  }
  
  private void uploadImage(){
      //Showing the progress dialog
      final ProgressDialog loading = ProgressDialog.show(this,"Uploading...","Please wait...",false,false);
      StringRequest stringRequest = new StringRequest(Request.Method.POST, UPLOAD_URL,
              new Response.Listener&lt;String&gt;() {
                  @Override
                  public void onResponse(String s) {
                      //Disimissing the progress dialog
                      loading.dismiss();
                      //Showing toast message of the response
                      Toast.makeText(MainActivity.this, s , Toast.LENGTH_LONG).show();
                  }
              },
              new Response.ErrorListener() {
                  @Override
                  public void onErrorResponse(VolleyError volleyError) {
                      //Dismissing the progress dialog
                      loading.dismiss();
  
                      //Showing toast
                      Toast.makeText(MainActivity.this, ""+volleyError, Toast.LENGTH_LONG).show();
                  }
              }){
          @Override
          protected Map&lt;String, String&gt; getParams() throws AuthFailureError {
              //Converting Bitmap to String
              String image = getStringImage(bitmap);
              //Getting Image Name
              String name = editTextName.getText().toString().trim();
              //Creating parameters
              Map&lt;String,String&gt; params = new Hashtable&lt;String, String&gt;()
              params.put("empsno", "81");
              params.put("storesno", "165");
              params.put("lrSno", "1808");
              params.put("recQty", "0");
              params.put("recVol", "0");
              params.put("recWgt", "0");
              params.put("damageQty", "0");
              params.put("looseQty", "0");
              params.put("deliveryDate", "2016-09-24");
              params.put("deliveryTime", "10:15");
              params.put("uploadFile", image);
              params.put("remarks", "mytestingrem");
              params.put("receivedBy", "amankumar");
              params.put("ipAddress", "12.65.65.32");
  
              //returning parameters
              return params;
          }
      };
  
      //Creating a Request Queue
      RequestQueue requestQueue = Volley.newRequestQueue(this);
  
      //Adding request to the queue
      requestQueue.add(stringRequest);
  }
  
  private void showFileChooser() {
      Intent intent = new Intent();
      intent.setType("image/*");
      intent.setAction(Intent.ACTION_GET_CONTENT);
      startActivityForResult(Intent.createChooser(intent, "Select Picture"), PICK_IMAGE_REQUEST);
  }
  
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
      super.onActivityResult(requestCode, resultCode, data);
  
      if (requestCode == PICK_IMAGE_REQUEST &amp;&amp; resultCode == RESULT_OK &amp;&amp; data != null &amp;&amp; data.getData() != null) {
          Uri filePath = data.getData();
          try {
              //Getting the Bitmap from Gallery
              bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), filePath);
              //Setting the Bitmap to ImageView
              imageView.setImageBitmap(bitmap);
          } catch (IOException e) {
              e.printStackTrace();
          }
      }
  }
  
  @Override
  public void onClick(View v) {
  
      if(v == buttonChoose){
          showFileChooser();
      }
  
      if(v == buttonUpload){
          uploadImage();
      }
  }
  </code></pre>
  
  <p>Please help me , how to upload the file with these parameter. I'm new in volley.  I simply copy paste this code from <code>https://www.simplifiedcoding.net/android-volley-tutorial-to-upload-image-to-server</code> . Even i don't know whether i'm using correctly or not.
  <strong>Thanks in advance</strong></p>