PHP script listing file directory

April 2018




Hello,
I am looking for a script which will give a list of files in a directory!
How can I do this??

You can use this:

function AffDir($rep)
{
$dir = opendir($rep);
while ($File = readdir($dir))
{
if($File != "." && $File != "..")
{
echo $File."<br>";
}
}
closedir($dir);
}

AffDir(".");
Published by aakai1056. Latest update on February 16, 2010 at 02:13 AM by aakai1056.
This document, titled "PHP script listing file directory," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (https://ccm.net/).
PHP - Clean up a string
PDO: Alternative way to access your databases