Skip to content

Commit 10aa6a6

Browse files
authored
Update filemanager.php
1 parent 2d34111 commit 10aa6a6

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

filemanager.php

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* The Kinsmen File Manager v2.2
4+
* The Kinsmen File Manager v2.2.1
55
*
66
* A comprehensive, modern file manager with cPanel styling and all essential features:
77
* - File Tree Navigation
@@ -19,8 +19,9 @@
1919
* - Sorting and filtering
2020
*/
2121

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+
2425

2526
// Configuration
2627
$config = [
@@ -1458,7 +1459,17 @@ function extract7Zip($source, $destination)
14581459
}
14591460
}
14601461

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+
14621473
if (isset($_FILES["files"])) {
14631474
header("Content-Type: application/json");
14641475
$currentPath = isset($_POST["path"])
@@ -1518,7 +1529,8 @@ function extract7Zip($source, $destination)
15181529
}
15191530

15201531
// 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) {
15221534
$failed++;
15231535
$failedFiles[] = $fileName . " (Exceeds maximum file size limit)";
15241536
continue;

0 commit comments

Comments
 (0)