Tinyfilemanager: 2.4.3

return true;

// Upload file size limit (in bytes) $upload_max_size = 50 * 1024 * 1024; // 50MB

// Actions $action = isset($_POST['action']) ? $_POST['action'] : (isset($_GET['action']) ? $_GET['action'] : '');

if ($action === 'upload' && isset($_FILES['file'])) $dest = $full_path . '/' . basename($_FILES['file']['name']); if (move_uploaded_file($_FILES['file']['tmp_name'], $dest)) echo "OK"; tinyfilemanager 2.4.3

// Simple auth check function auth($users, $read_only_users = array()) if (!isset($_SESSION['loggedin'])) if (isset($_SERVER['PHP_AUTH_USER']) && isset($users[$_SERVER['PHP_AUTH_USER']])) $pass = $_SERVER['PHP_AUTH_PW']; $hash = $users[$_SERVER['PHP_AUTH_USER']]; if (password_verify($pass, $hash)) $_SESSION['loggedin'] = $_SERVER['PHP_AUTH_USER']; $_SESSION['readonly'] = in_array($_SERVER['PHP_AUTH_USER'], $read_only_users); return true;

<?php // TinyFileManager 2.4.3 // https://github.com/prasathmani/tinyfilemanager // Released under MIT License session_name('filemanager'); session_start();

// Show or hide hidden files (dot files) $show_hidden_files = false; return true; // Upload file size limit (in

if ($full_path === false || strpos($full_path, $root_path) !== 0) $full_path = $root_path; $current_path = '';

// Main logic $current_path = isset($_GET['path']) ? $_GET['path'] : ''; $full_path = $root_path . '/' . ltrim($current_path, '/'); $full_path = realpath($full_path);

$listing = list_directory($full_path, $show_hidden_files); ?> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>TinyFileManager 2.4.3</title> <style> body font-family: sans-serif; margin: 20px; background: #f4f4f4; .container max-width: 1200px; margin: auto; background: white; padding: 20px; border-radius: 8px; h1 margin-top: 0; table width: 100%; border-collapse: collapse; th, td text-align: left; padding: 8px; border-bottom: 1px solid #ddd; th background: #eee; .btn display: inline-block; padding: 6px 12px; background: #007bff; color: white; text-decoration: none; border-radius: 4px; .btn-danger background: #dc3545; .form-inline display: inline; input, button padding: 6px; margin: 2px; .breadcrumb margin-bottom: 20px; .upload-area margin-bottom: 20px; background: #e9ecef; padding: 10px; border-radius: 4px; footer margin-top: 20px; text-align: center; font-size: 12px; color: gray; </style> </head> <body> <div class="container"> <h1>📁 TinyFileManager 2.4.3</h1> <div class="breadcrumb"> <a href="?path=">Root</a> <?php $parts = explode('/', trim($current_path, '/')); $build = ''; foreach ($parts as $part) if ($part === '') continue; $build .= '/' . $part; echo ' / <a href="?path=' . urlencode(ltrim($build, '/')) . '">' . htmlspecialchars($part) . '</a>'; $show_hidden) $files = scandir($path)

// ============================================= // DO NOT EDIT BELOW UNLESS YOU KNOW WHAT YOU DO // =============================================

You can save this as tinyfilemanager.php and place it in your web root.

function list_directory($path, $show_hidden) $files = scandir($path); $result = array('dirs' => array(), 'files' => array()); foreach ($files as $file) if ($file === '.' sort($result['dirs']); sort($result['files']); return $result;

<?php if (!$readonly): ?> <div class="upload-area"> <form method="post" enctype="multipart/form-data" id="uploadForm"> <input type="file" name="file" id="fileInput"> <button type="submit">Upload</button> </form> <form method="post" style="margin-top: 10px;"> <input type="hidden" name="action" value="mkdir"> <input type="text" name="name" placeholder="New folder name" required> <button type="submit">Create Folder</button> </form> </div> <?php endif; ?>

Rulla till toppen