PDA

View Full Version : Getting the files?



Joe!
04-12-2007, 05:15 PM
How can i make a php page that when in a certain directory, would display all the other files in that directory?
Any help would be really appreciated and rep given :)
Joe

ZAG
04-12-2007, 06:27 PM
<?php

$path = "path/to/folder";

$dir = @opendir($path) or die("Can't open $path");

while ($item = readdir($dir)){
echo "<a href='$item'>$item</a><br>";
}

closedir($dir);

?>

Mr Macro
04-12-2007, 08:19 PM
Ah, i didn't know you could do that with PHP. A prime example that no matter how good at PHP you are, you can always learn more.Thanks ZAG +REP

Want to hide these adverts? Register an account for free!