|
1 | 1 | <?php |
2 | 2 |
|
3 | 3 | /** |
4 | | - * The Kinsmen File Manager v2.2 |
| 4 | + * The Kinsmen File Manager v2.2.1 |
5 | 5 | * |
6 | 6 | * A comprehensive, modern file manager with cPanel styling and all essential features: |
7 | 7 | * - File Tree Navigation |
|
19 | 19 | * - Sorting and filtering |
20 | 20 | */ |
21 | 21 |
|
22 | | -$username = ""; // Username for directory listing |
23 | | -$root_path = ""; // Path to the root directory |
| 22 | +$username = ""; // username for dir listing |
| 23 | +$root_path = ""; // root dir |
| 24 | + |
24 | 25 |
|
25 | 26 | // Configuration |
26 | 27 | $config = [ |
@@ -1458,7 +1459,17 @@ function extract7Zip($source, $destination) |
1458 | 1459 | } |
1459 | 1460 | } |
1460 | 1461 |
|
1461 | | -// Handle file uploads - this replaces the existing file upload handler in your PHP code |
| 1462 | + |
| 1463 | +function parseSize($size) { |
| 1464 | + $unit = preg_replace('/[^bkmgtpezy]/i', '', $size); |
| 1465 | + $size = preg_replace('/[^0-9\.]/', '', $size); |
| 1466 | + if ($unit) { |
| 1467 | + return round($size * pow(1024, stripos('bkmgtpezy', $unit[0]))); |
| 1468 | + } |
| 1469 | + return round($size); |
| 1470 | +} |
| 1471 | + |
| 1472 | + |
1462 | 1473 | if (isset($_FILES["files"])) { |
1463 | 1474 | header("Content-Type: application/json"); |
1464 | 1475 | $currentPath = isset($_POST["path"]) |
@@ -1518,7 +1529,8 @@ function extract7Zip($source, $destination) |
1518 | 1529 | } |
1519 | 1530 |
|
1520 | 1531 | // File size check |
1521 | | - if ($files["size"][$i] > ini_get('upload_max_filesize')) { |
| 1532 | + $maxFileSize = parseSize(ini_get('upload_max_filesize')); |
| 1533 | + if ($files["size"][$i] > $maxFileSize) { |
1522 | 1534 | $failed++; |
1523 | 1535 | $failedFiles[] = $fileName . " (Exceeds maximum file size limit)"; |
1524 | 1536 | continue; |
|
0 commit comments