Tinyfilemanager 2.4.3 (Trusted)

if ($action === 'delete' && isset($_POST['file'])) $target = $full_path . '/' . basename($_POST['file']); if (is_file($target)) unlink($target); if (is_dir($target)) array_map('unlink', glob($target . '/*')) && rmdir($target);

<?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; ?>

// Allowed extensions (empty = all) $allowed_extensions = array( 'jpg','jpeg','png','gif','pdf','txt','doc','docx','xls','xlsx', 'zip','tar','gz','mp3','mp4','php','html','css','js' );

// Read-only users $read_only_users = array('user'); tinyfilemanager 2.4.3

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

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

// ============================================= // DO NOT EDIT BELOW UNLESS YOU KNOW WHAT YOU DO // ============================================= if ($action === 'delete' && isset($_POST['file'])) $target =

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);

// Show or hide hidden files (dot files) $show_hidden_files = false;

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

sort($result['dirs']); sort($result['files']); return $result;

if ($use_auth) auth($auth_users, $read_only_users); $readonly = $_SESSION['readonly']; else $readonly = false;

if (!$readonly) if ($action === 'mkdir' && isset($_POST['name'])) $newdir = $full_path . '/' . basename($_POST['name']); if (!file_exists($newdir)) mkdir($newdir, 0755);

function list_directory($path, $show_hidden) $files = scandir($path); $result = array('dirs' => array(), 'files' => array()); foreach ($files as $file) $file === '..') continue; if (!$show_hidden && $file[0] === '.') continue; $full = $path . '/' . $file; if (is_dir($full)) $result['dirs'][] = $file; else $result['files'][] = $file;