open('./videos/sources/DSCN1082.MP4'); var_dump($_GET['file']); // Navigate to directory or download file if (isset($_GET['file'])) { // If the file is a directory if (is_dir($_GET['file'])) { // Update the current directory $current_directory = $_GET['file'] . '/'; } else { // Download file header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . basename($_GET['file']) . '"'); readfile($_GET['file']); exit; } } // Retrieve all files and directories $results = glob(str_replace(['[',']',"\f[","\f]"], ["\f[","\f]",'[[]','[]]'], ($current_directory ? $current_directory : $initial_directory)) . '*'); // If true, directories will appear first in the populated file list $directory_first = true; // Sort files if ($directory_first) { usort($results, function($a, $b){ $a_is_dir = is_dir($a); $b_is_dir = is_dir($b); if ($a_is_dir === $b_is_dir) { return strnatcasecmp($a, $b); } else if ($a_is_dir && !$b_is_dir) { return -1; } else if (!$a_is_dir && $b_is_dir) { return 1; } }); } // Convert bytes to human readable format function convert_filesize($bytes, $precision = 2) { $units = ['Bytes', 'KB', 'MB', 'GB', 'TB']; $bytes = max($bytes, 0); $pow = floor(($bytes ? log($bytes) : 0) / log(1024)); $pow = min($pow, count($units) - 1); $bytes /= pow(1024, $pow); return round($bytes, $precision) . ' ' . $units[$pow]; } function get_filetype_icon($filetype) { if (is_dir($filetype)) { return ''; } else if (preg_match('/image\/*/', mime_content_type($filetype))) { return ''; } else if (preg_match('/video\/*/', mime_content_type($filetype))) { return ''; } else if (preg_match('/audio\/*/', mime_content_type($filetype))) { return ''; } else if (preg_match('/audio\/*/', mime_content_type($filetype))) { return ''; } return ''; } ?> File Management System

Name Size Modified Actions
...