Find out all files of a directory with function in php

Mahabubur Rahman
0
In this topics we'll discus on "how to find out all files of a directory of web server". It will give you knowledge about working with files.



We will create a simple function to find out files of a directory.

function files()
{
$path = './uploads/';
$prefix='x';
if ($handle = opendir($path)) {
var_dump(opendir($path));
   while (false !== ($file = readdir($handle))) {
    echo $file.'<br/>';         }
   }
}
}
After write this simple function now we can call this function as follow-
files();
Now see it show a list of files name.

Post a Comment

0Comments
Post a Comment (0)