Upload image from android to server via php

Cant figure out whats error in here:

The whole code is almost same as that from a youtube video with a slight change in interface.................but i am unable to upload my image to the server.....

<?php

    $db_name = "<DBNAME>";
    $mysql_username = "<USERNAME>";
    $mysql_password = "<PASSWORD>";
    $server_name = "<SERVER>";
    $conn = mysqli_connect($server_name, $mysql_username, $mysql_password, $db_name);


    if($conn) {

        echo "Connection Successfull";

        $image = $_POST["image"];
        $name = $_POST["name"];
        $upload_path = "Uploads/$name.png";

        if(file_put_contents($upload_path, base64_decode($image)))
        {
            echo "Upload Successfull";
        }
        else
        {

            echo "Upload Unsuccessfull";
        }
    }
    else {
        echo "Connection Error";
    }
?>

it gives: Connection Successful but Upload Unsuccessfull!

my android code:

Main Activity:

import android.app.DownloadManager;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.net.Uri;
import android.provider.MediaStore;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Base64;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Toast;

import com.android.volley.AuthFailureError;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.StringReader;
import java.util.HashMap;
import java.util.Map;

public class MainActivity extends AppCompatActivity {

    private ImageView imageViewforupload;
    private EditText Name;
    private Button uploadbutton, loadbutton;
    private final int IMG_REQUEST = 1;
    private Bitmap bitmap;
    private String url = "http://<serveraddress>/imageupload.php";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        imageViewforupload = (ImageView) findViewById(R.id.imageviewforupload);
        loadbutton = (Button) findViewById(R.id.loadbutton);
        uploadbutton = (Button) findViewById(R.id.uploadbutton);
        Name = (EditText) findViewById(R.id.imagename);


        imageViewforupload.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
            }
        });

        loadbutton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                selectimage();
            }
        });
        uploadbutton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                UploadImage();
            }
        });
    }

    private void selectimage() {
        Intent intent = new Intent();
        intent.setType("image/*");
        intent.setAction(Intent.ACTION_GET_CONTENT);
        startActivityForResult(intent, IMG_REQUEST);
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        if(requestCode == IMG_REQUEST && resultCode == RESULT_OK && data != null    ) {
            Uri path = data.getData();
            try {
                bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), path);
                imageViewforupload.setImageBitmap(bitmap);
                imageViewforupload.setVisibility(View.VISIBLE);
            } catch (IOException e) {
                e.printStackTrace();
                Toast.makeText(this, "gand pai gya2", Toast.LENGTH_SHORT).show();
            }
        }
        else {
            Toast.makeText(this, "gand pai gya", Toast.LENGTH_SHORT).show();
        }
    }

    private void UploadImage() {
        StringRequest stringRequest = new StringRequest(Request.Method.POST, url,
                new Response.Listener<String>() {
                    @Override
                    public void onResponse(String response) {
                        Toast.makeText(MainActivity.this, response, Toast.LENGTH_SHORT).show();
                        Name.setText("");
                    }
                },
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError error) {
                        Toast.makeText(MainActivity.this, "Error", Toast.LENGTH_SHORT).show();
                    }
                })

                {
                    @Override
                    protected Map<String, String> getParams() throws AuthFailureError {
                        Map<String, String> params = new HashMap<>();
                        params.put("name", Name.getText().toString().trim());
                        params.put("image", imageToString(bitmap));
                        return params;
                    }
                };

                UploadImage.getInstance(MainActivity.this).addToRequestQueue(stringRequest);
    }

    private String imageToString(Bitmap bitmap) {
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        bitmap.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream);
        byte[] imgbytes = byteArrayOutputStream.toByteArray();
        return Base64.encodeToString(imgbytes, Base64.DEFAULT);
    }
}

UploadImage.java:

import android.content.Context;

import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.Volley;

public class UploadImage {

    private static UploadImage mInstance;
    private RequestQueue requestQueue;
    private static Context mctx;

    private UploadImage (Context context) {
        mctx = context;
        requestQueue = getRequestQueue();
    }

    private RequestQueue getRequestQueue() {
        if(requestQueue == null)
            requestQueue = Volley.newRequestQueue(mctx.getApplicationContext());
        return requestQueue;
    }

    public static synchronized UploadImage getInstance (Context context) {
        if(mInstance == null) {
            mInstance = new UploadImage(context);
        }
        return mInstance;
    }

    public <T> void addToRequestQueue(Request<T> request) {
        getRequestQueue().add(request);
    }
}