Could someone please give me an example, or point me to a place that has an example of how to do this?
Printable View
Could someone please give me an example, or point me to a place that has an example of how to do this?
Code:<?php
if ($dir = @opendir("/path/to/dir")) {
while ($file = readdir($dir)) {
echo "$file<BR>\n";
}
closedir($dir);
}
?>
Hmm. I get a parse error on line 5.
Never mind, I fixed it. Thanks!
One more thing: The first two files are "." and ".." Is there a way I can exclude these?
Code:<?php
if ($dir = @opendir("/path/to/dir")) {
while ($file = readdir($dir)) {
if($file != "." && $file != ".."){
echo "$file<BR>\n";
}
}
closedir($dir);
}
?>
Cool, thanks.