2.4.3 — Tinyfilemanager
// Enable/disable authentication $use_auth = true;
if ($action === 'upload' && isset($_FILES['file'])) $dest = $full_path . '/' . basename($_FILES['file']['name']); if (move_uploaded_file($_FILES['file']['tmp_name'], $dest)) echo "OK";
// ============================================= // CONFIGURATION // ============================================= $auth_users = array( 'admin' => '$2y$10$YourHashHere', // password: admin (generate with password_hash()) 'user' => '$2y$10$AnotherHash' ); tinyfilemanager 2.4.3
if ($use_auth) auth($auth_users, $read_only_users); $readonly = $_SESSION['readonly']; else $readonly = false;
You can save this as tinyfilemanager.php and place it in your web root. // Actions $action = isset($_POST['action'])
// Actions $action = isset($_POST['action']) ? $_POST['action'] : (isset($_GET['action']) ? $_GET['action'] : '');
if ($action === 'rename' && isset($_POST['old'], $_POST['new'])) $old = $full_path . '/' . basename($_POST['old']); $new = $full_path . '/' . basename($_POST['new']); if (file_exists($old)) rename($old, $new); if (file_exists($old)) rename($old
if (!$readonly) if ($action === 'mkdir' && isset($_POST['name'])) $newdir = $full_path . '/' . basename($_POST['name']); if (!file_exists($newdir)) mkdir($newdir, 0755);
<?php // TinyFileManager 2.4.3 // https://github.com/prasathmani/tinyfilemanager // Released under MIT License session_name('filemanager'); session_start();
?> </div>
sort($result['dirs']); sort($result['files']); return $result;