List files and directories in a folder in php
by rajesh[ Edit ] 2010-01-02 16:23:50
we can list files and directories inside a folder or file path using the function scandir
scandir — List files and directories inside the specified path
Returns an array of files and directories from the directory .
$dir = "./temp";
$files = scandir($dir);
print_r($files);
Example output
Array
(
[0] => .
[1] => ..
[2] => filename1
[3] => filename2
)