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

     if (isset($_POST['Path'])){

        $Path = $_POST['Path'];
        
        if (file_exists($Path)) {
            $files = scandir($Path);
            $files = array_diff(scandir($Path), array('.', '..'));
            $return = $files;
        }else{
            $return = "0";
        }

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