Added ENV var to change default file upload size limit. New default value is 100MB

This commit is contained in:
Eldad Fux
2020-02-13 20:55:12 +02:00
parent c04c12cf06
commit 53a1cda21c
9 changed files with 49 additions and 34 deletions
-24
View File
@@ -163,28 +163,4 @@ abstract class Device
* @return float
*/
abstract public function getPartitionTotalSpace():float;
/**
* Human readable data size format from bytes input.
*
* As published on https://gist.github.com/liunian/9338301 (first comment)
*
* @param int $bytes
* @param int $decimals
*
* @return string
*/
public function human($bytes, $decimals = 2)
{
$units = array('B','kB','MB','GB','TB','PB','EB','ZB','YB');
$step = 1024;
$i = 0;
while (($bytes / $step) > 0.9) {
$bytes = $bytes / $step;
++$i;
}
return round($bytes, $decimals).$units[$i];
}
}
+24
View File
@@ -67,4 +67,28 @@ class Storage
{
return (bool) array_key_exists($name, self::$devices);
}
/**
* Human readable data size format from bytes input.
*
* As published on https://gist.github.com/liunian/9338301 (first comment)
*
* @param int $bytes
* @param int $decimals
*
* @return string
*/
static public function human($bytes, $decimals = 2)
{
$units = array('B','kB','MB','GB','TB','PB','EB','ZB','YB');
$step = 1024;
$i = 0;
while (($bytes / $step) > 0.9) {
$bytes = $bytes / $step;
++$i;
}
return round($bytes, $decimals).$units[$i];
}
}