advice on building php based file manager
989
I am trying to build a php based file management system, but am having a few problems, basically I have found a script but it has problems reading directory names with spaces in them, here is the script :
<?php
global $dir_path;
if (isset($_GET["directory"])) {
$dir_path = $_GET["directory"];
//echo $dir_path;
}
else {
$dir_path = $_SERVER["DOCUMENT_ROOT"]."/";
}
$directories = scandir($dir_path);
foreach($directories as $entry) {
if (is_dir($dir_path . "/" . $entry) && !in_array($entry, array('.','..'))) {
echo "<a href=?directory=" . $dir_path . "" . $entry . "/" . "><li>" . $entry . "</li></a>";
}
else {}
}
?>
Any help would be greatly appreciated, thanks!