<?php

	require_once '../../autoload.php';

  $res = array (
      "status"    => 'KO',
      "fileslist" => null
  ); 
	
	$folder       = $_SERVER["DOCUMENT_ROOT"].$_POST['folder'];
	
  $files_list = scandir ( $folder );

  if ( $files_list != false )
    $res['fileslist'] = $files_list;

  header('Content-type: application/json');
  $result = json_encode ( $res );
  
  echo $result;

?>
