Click to See Complete Forum and Search --> : getting a list of files in the folder


esm
09-08-2003, 05:44 PM
I am delving into the unknown here. I need to put all the files in folder on the server into a select statement.

can someone point me in the right direction?

pyro
09-08-2003, 06:52 PM
This will echo out all the files in a certain directory:

<?PHP

$folder = "somedir/";
$handle = opendir($folder);

# Making an array containing the files in the current directory:
while ($file = readdir($handle))
{
$files[] = $file;
}
closedir($handle);

#echo the files
foreach ($files as $file) {
echo $file."<br />";
}
?>