<?php
// array for JSON response
  $response= array();

    if (isset($_POST['DisplayImage']) && isset($_POST['Name']) && isset($_POST['ClientID']) && isset($_POST['ID4'])){

      $DisplayImage = $_POST['DisplayImage'];
	  $Name = $_POST['Name'];
	  $ClientID = $_POST['ClientID'];
	  $ID4 = $_POST['ID4'];

      $folder = "ProjectImages/ClassifiedAdsImages/AdsCategory4";
      
      $path = $folder."/".$ClientID."/".$ID4."/SliderImages";
      
      if (!file_exists($path)) {
            mkdir($path, 0777, true);
      }
      
      $decodedImage = base64_decode($DisplayImage);
      $return = file_put_contents($path."/".$Name, $decodedImage);

      // success
      $response["success"] = 1;
      $response["message"] = $return;
      // echoing JSON response
      echo json_encode($response);
    }else{
		// success
      $response["success"] = 0;
      $response["message"] = "IMAGE NOT SEND";
      // echoing JSON response
      echo json_encode($response);
	}
?>
