Ask a question »

PHP script listing file directory

May 2015


PHP script listing file directory




Issue


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

Solution


You can use this:

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

AffDir(".");
For unlimited offline reading, you can download this article for free in PDF format:
Php-script-listing-file-directory.pdf

See also

In the same category

Published by aakai1056.
This document entitled « PHP script listing file directory » from Kioskea (en.kioskea.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.