Jump to content

Help with a Directory Browser


oasmar

Recommended Posts

Hey Guys, i have tried to make a Directory browser for Website, it is for admins to edit pages.

I want to it have two seperate links, one for directorys and one for files.

 

$dir = $_GET['path'];

if(!$_GET['path']){
$dir = $sitedir;
}

echo "<div align=\"left\"><h1>Directory:</h1>";

$dh = opendir($dir);
while (($file = readdir($dh)) !== false) {
if ($file == "." || $file == ".."  ) {
}else{

if(is_dir($file)){
// if it is a directory i want it to use this link
echo "<a href='$_SERVER[php_SELF]?dir=fileeditor&path=$dir$file/'>$file</a><br />";

}else{
// if it is a file i want it to use this link
echo "<a href='$_SERVER[php_SELF]?dir=fileeditor&file=$dir$file'>$file</a><br />";

}


}
}

closedir($dh);

 

As you can see i have tried to use the is_dir but this hasnt worked. Please help!

Link to comment
https://forums.phpfreaks.com/topic/56588-help-with-a-directory-browser/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.