body{font-family:Arial;background:#222;color:#fff;} input,button{padding:8px;width:100%}

Login File Manager



"; exit; } /* --------------------------- BASIC CONFIG --------------------------- */ $root = __DIR__; $req = isset($_GET['path']) ? trim($_GET['path'], "/") : ""; $path = realpath($root . "/" . $req); if (!$path || strpos($path, $root) !== 0) die("Invalid path"); function h($s){ return htmlspecialchars($s); } function list_dir($d){ return array_diff(scandir($d), ['.','..']); } /* --------------------------- FILE ACTIONS --------------------------- */ # Create folder if (isset($_POST['newfolder'])) mkdir($path."/".$_POST['newfolder']); # Create empty file if (isset($_POST['newfile'])) file_put_contents($path."/".$_POST['newfile'], ""); # Upload file if (!empty($_FILES['upload']['name'])) move_uploaded_file($_FILES['upload']['tmp_name'], $path."/".$_FILES['upload']['name']); # Delete file/folder if (isset($_GET['delete'])) { $target = $path."/".$_GET['delete']; if (is_dir($target)) rmdir($target); if (is_file($target)) unlink($target); header("Location: ?path=".urlencode($req)); exit; } # Rename if (isset($_POST['rename_old'])) { rename($path."/".$_POST['rename_old'], $path."/".$_POST['rename_new']); } # Save edited file if (isset($_POST['savefile']) && isset($_GET['edit'])) { file_put_contents($path."/".$_GET['edit'], $_POST['savefile']); header("Location: ?path=".urlencode($req)); exit; } # Download if (isset($_GET['download'])) { $file = $path."/".$_GET['download']; header("Content-Type: application/octet-stream"); header("Content-Disposition: attachment; filename=".basename($file)); readfile($file); exit; } /* --------------------------- EDIT FILE VIEW --------------------------- */ if (isset($_GET['edit'])) { $file = $path."/".$_GET['edit']; $content = file_get_contents($file); echo "

Edit File: ".h($_GET['edit'])."



Back

"; exit; } /* --------------------------- DARK MODE + STYLE --------------------------- */ echo " "; /* --------------------------- BREADCRUMB VIRTUAL PATH --------------------------- */ echo "

Mini File Manager

"; echo "

"; $crumbs = explode("/", $req); echo "Path: "; echo "/"; $tmp = ""; foreach ($crumbs as $c) { if (!$c) continue; $tmp .= ($tmp ? "/" : "") . $c; echo " / ".h($c).""; } /* --------------------------- BREADCRUMB REAL PATH (klik-able) --------------------------- */ echo "
Real Path: "; $real = trim($path, "/"); $parts = explode("/", $real); $realBuild = ""; foreach ($parts as $i => $p) { $realBuild .= "/".$p; $virtualCandidate = str_replace($root, "", $realBuild); $virtualCandidate = trim($virtualCandidate, "/"); echo "/".h($p).""; } echo "

"; /* --------------------------- BACK BUTTON --------------------------- */ $parent = dirname($req); echo "⬅ Back to parent

"; /* --------------------------- FORMS --------------------------- */ echo "

Create Folder

Create File

Upload File


"; /* --------------------------- DIRECTORY TABLE --------------------------- */ echo "

Directory Listing

"; echo ""; foreach (list_dir($path) as $item) { $full = $path."/".$item; echo ""; } echo "
NameActions
".h($item).""; if (is_dir($full)) { echo "Open | "; } else { echo "Edit | "; echo "Download | "; } echo "
| "; echo "Delete"; echo "
"; ?>