advice on building php based file manager


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 :

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!

People are also looking for solutions to the problem: mutex - PHP flock() for read-modify-write does not work


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.