file_exists($filePath) && !$sftp->is_dir($filePath)) { if (in_array(strtolower($extension), $editableExtensions)) { $editable = true; if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['content']) && isset($_SESSION["upPer"]) && $_SESSION["upPer"] == true) { $newContent = $_POST['content']; if ($sftp->put($filePath, $newContent)) { $saveSuccess = true; } else { $saveError = "Failed to save changes. Check permissions."; } } $content = $sftp->get($filePath); if ($content === false) { $error = "Failed to read file contents."; } } else { $error = "This file type is not supported for editing."; } } else { $error = "File not found or is a directory."; } $showLineNumbers = in_array(strtolower($extension), ['php', 'js', 'html', 'css', 'py', 'java', 'c', 'cpp', 'h', 'hpp', 'rb', 'sh', 'xml', 'json']); $parentDir = dirname($filePath); ?> Edit File - <?= htmlspecialchars($fileName) ?>

Edit File:

Back to File List
File saved successfully!
Read-only mode (you don't have upload permissions)