mirror of
https://github.com/prasathmani/tinyfilemanager
synced 2024-06-02 05:52:12 +02:00
parent
bb0e61787c
commit
622264042a
|
@ -70,6 +70,9 @@ $GLOBALS['online_viewer'] = true;
|
||||||
//Sticky Nav bar
|
//Sticky Nav bar
|
||||||
$sticky_navbar = true;
|
$sticky_navbar = true;
|
||||||
|
|
||||||
|
//max upload file size
|
||||||
|
define('MAX_UPLOAD_SIZE', '2048');
|
||||||
|
|
||||||
// private key and session name to store to the session
|
// private key and session name to store to the session
|
||||||
if ( !defined( 'FM_SESSION_ID')) {
|
if ( !defined( 'FM_SESSION_ID')) {
|
||||||
define('FM_SESSION_ID', 'filemanager');
|
define('FM_SESSION_ID', 'filemanager');
|
||||||
|
@ -935,7 +938,7 @@ if (isset($_GET['upload']) && !FM_READONLY) {
|
||||||
<script>
|
<script>
|
||||||
Dropzone.options.fileUploader = {
|
Dropzone.options.fileUploader = {
|
||||||
timeout: 120000,
|
timeout: 120000,
|
||||||
maxFilesize: 2048, //2GB
|
maxFilesize: <?php echo MAX_UPLOAD_SIZE; ?>,
|
||||||
init: function () {
|
init: function () {
|
||||||
this.on("sending", function (file, xhr, formData) {
|
this.on("sending", function (file, xhr, formData) {
|
||||||
let _path = (file.fullPath) ? file.fullPath : file.name;
|
let _path = (file.fullPath) ? file.fullPath : file.name;
|
||||||
|
@ -1996,18 +1999,47 @@ function fm_get_translations($tr) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $file
|
* @param $file
|
||||||
* Recover all file sizes larger than > 4GB.
|
* Recover all file sizes larger than > 2GB.
|
||||||
* Works on php 32bits and 64bits and supports linux
|
* Works on php 32bits and 64bits and supports linux
|
||||||
* @return int|string
|
* @return int|string
|
||||||
*/
|
*/
|
||||||
function fm_get_size($file)
|
function fm_get_size($file)
|
||||||
{
|
{
|
||||||
$return = filesize($file);
|
static $iswin;
|
||||||
if(substr(PHP_OS, 0, 3) == "WIN") {
|
if (!isset($iswin)) {
|
||||||
exec('for %I in ("'.$file.'") do @echo %~zI', $output);
|
$iswin = (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN');
|
||||||
$return = $output[0];
|
|
||||||
}
|
}
|
||||||
return $return;
|
|
||||||
|
static $exec_works;
|
||||||
|
if (!isset($exec_works)) {
|
||||||
|
$exec_works = (function_exists('exec') && !ini_get('safe_mode') && @exec('echo EXEC') == 'EXEC');
|
||||||
|
}
|
||||||
|
|
||||||
|
// try a shell command
|
||||||
|
if ($exec_works) {
|
||||||
|
$cmd = ($iswin) ? "for %F in (\"$file\") do @echo %~zF" : "stat -c%s \"$file\"";
|
||||||
|
@exec($cmd, $output);
|
||||||
|
if (is_array($output) && ctype_digit($size = trim(implode("\n", $output)))) {
|
||||||
|
return $size;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// try the Windows COM interface
|
||||||
|
if ($iswin && class_exists("COM")) {
|
||||||
|
try {
|
||||||
|
$fsobj = new COM('Scripting.FileSystemObject');
|
||||||
|
$f = $fsobj->GetFile( realpath($file) );
|
||||||
|
$size = $f->Size;
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$size = null;
|
||||||
|
}
|
||||||
|
if (ctype_digit($size)) {
|
||||||
|
return $size;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// if all else fails
|
||||||
|
return filesize($file);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue