this is my php code and android code and my volley class, I am getting error in the php file, Notice: Undefined index: image in /storage/h11/583/1763583/public_html/imageuploadapp/updateinfo.php on line 11
Notice: Undefined index: name in /storage/h11/583/1763583/public_html/imageuploadapp/updateinfo.php on line 12
and android file:
        <?php
            $user_name = "root";
            $user_pass = "root";
            $host_name = "localhost";
            $db_name = "mydata";
            $con = mysqli_connect($host_name,$user_name,$user_pass,$db_name);
            if($con){
                $image = $_POST['image'];
                $name = $_POST['name'];
                $sql = "insert into imageinfo(name) values('$name')";
                $upload_path = "uploads/$name.jpg";
                if(mysqli_query($con,$sql)){
                    file_put_contents($upload_path,base64_decode($image));
                    echo json_encode(array('response'=>'Image Uploaded Successfully'));
                }
                else{
                    echo json_encode(array('response'=>'Image Upload Failed'));
                }
            }
            else{
                    echo json_encode(array('response'=>'Image upload fail'));
            }
            mysqli_close($con);
            ?>
            public class ProfileSetup extends AppCompatActivity implements View.OnClickListener {
                private Button chooseBn, uploadBn;
                private EditText name;
                private ImageView imageView;
                private final int IMG_REQUEST = 1;
                private Bitmap bitmap;
                private String UploadUrl = "https://10.0.2.2/imageuploadapp/updateinfo.php";  //10.0.2.2 is used for virtual device to access localhost
                @Override
                protected void onCreate(Bundle savedInstanceState) {
                    super.onCreate(savedInstanceState);
                    setContentView(R.layout.activity_profile_setup);
                    chooseBn = (Button)findViewById(R.id.chooseBn);
                    uploadBn = (Button)findViewById(R.id.uploadBn);
                    name = (EditText)findViewById(R.id.name);
                    imageView = (ImageView)findViewById(R.id.imageView);
                    chooseBn.setOnClickListener(this);
                    uploadBn.setOnClickListener(this);
                }
                @Override
                public void onClick(View v) {
                    switch (v.getId()){
                        case R.id.chooseBn:
                            selectImage();
                            break;
                        case R.id.uploadBn:
                            uploadImage();
                            break;
                    }
                }
                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);
                            imageView.setImageBitmap(bitmap);
                        } catch (IOException e) {
                            e.printStackTrace();
                        }
                    }
                }
                private void uploadImage(){
                    StringRequest stringRequest = new StringRequest(Request.Method.POST, UploadUrl,
                            new Response.Listener<String>() {
                                @Override
                                public void onResponse(String response) {
                                    try {
                                        JSONObject jsonObject = new JSONObject(response);
                                        String Response = jsonObject.getString("response");
                                        Toast.makeText(ProfileSetup.this,Response,Toast.LENGTH_LONG).show();
                                    } catch (JSONException e) {
                                        e.printStackTrace();
                                    }
                                }
                            }, new Response.ErrorListener() {
                        @Override
                        public void onErrorResponse(VolleyError error) {
                        }
                    })
                    {
                        @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;
                        }
                    };
                    MySingleton.getInstance(ProfileSetup.this).addToRequestQue(stringRequest);
                }
                private String imageToString(Bitmap bitmap){
                    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
                    bitmap.compress(Bitmap.CompressFormat.JPEG,100,byteArrayOutputStream);
                     byte[] imgBytes = byteArrayOutputStream.toByteArray();
                    return Base64.encodeToString(imgBytes,Base64.DEFAULT);
                }
            }
    my volley class
    public class MySingleton {
        private static MySingleton mInstance;
        private RequestQueue requestQueue;
        private static Context mCtx;
        private MySingleton(Context context){
            mCtx = context;
            requestQueue = getRequestQueue();
        }
        private RequestQueue getRequestQueue(){
            if(requestQueue==null){
                requestQueue = Volley.newRequestQueue(mCtx.getApplicationContext());
            }
            return requestQueue;
        }
        public static synchronized MySingleton getInstance(Context context){
            if(mInstance==null){
                mInstance = new MySingleton(context);
            }
            return mInstance;
        }
        public<T> void addToRequestQue(Request<T> request){
            getRequestQueue().add(request);
        }
    }
