File "list_file_in_folder.php"

Full Path: /home/analogde/www/XTRAIL/WORKAREA/list_file_in_folder.php
File size: 798 bytes
MIME-type: text/x-php
Charset: utf-8

<?php

chdir("uploads");
$return_array = array();

$result = array();

$id = 1;

if ($handle = opendir('.')) 
{

    while (false !== ($file = readdir($handle))) 
	{
			if($file == "." or $file == "..")
			{
			}
			else
			{
				//$return_array[] = $file  . "|" . date ("d-m-Y|H:i:s", filemtime($file));
				
				if(is_file($file))
				{
					$nom = $file;
					$date_info = date ("d-m-Y|H:i:s", filemtime($file));
					
					array_push($result,	array('id'=>$id, 'name'=>$nom,'address'=>$date_info ));
					$id = $id + 1;
				}
				
			}
    }
    //echo json_encode($return_array);
	echo json_encode(array("result"=>$result));
    closedir($handle);
}



	/**while($row = mysqli_fetch_array($res))
	{
		array_push($result,	array('id'=>$row[0], 'name'=>$row[1],'address'=>$row[2]  ));
	}*/
	
	

?>