0
Is it possible to list the files of a directory with ajax and php? I did some research but I can’t find that combination!
$path = "/home/projetoc/public_html/filemanagerarquiv/files/";
$diretorio = dir($path);
echo "Lista de Arquivos do diretório '<strong>".$path."</strong>':<br />";
while($arquivo = $diretorio -> read()){
echo "<a href='".$path.$arquivo."'>".$arquivo."</a><br />";
}
$diretorio -> close();
Yes it is possible! logic is in php and at the end it can hide a json for javascript to display or manipulate.
– rray
And how would this listing with ajax. I updated the question!
– Thiago
Instead of echo, make an assignment in an array with the link, after while send a
echo json_encode($arrayDeLinks);. AI in javascript you manipulate json as you see fit, just to test aconsole.log(data), date is returned variable in ajax– rray
Generate an array with the directories and convert to json, then just manipulate the data with Ajax.
– Dunga Cardoso