<?php  
 include"connection.php";  
 if(isset($_POST['images'])){  
   $target_path = "Images/";  
   $image = $_POST['images'];  
   $name = $_POST['name'];  
   $imageStore = rand()."_".time().".jpeg";  
   $target_path = $target_path."/".$imageStore;  
   file_put_contents($target_path, base64_decode($image));  
   $select = "INSERT INTO `usersData`(`images`, `name`) VALUES ('$imageStore','$name')";  
   $response = mysqli_query($con,$select);  
   if($response){  
     echo "Image Upload";  
     mysqli_close($con);  
   } else{  
     echo "Something Wrong";  
   }  
 }  
 ?>