mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Added ENV var to change default file upload size limit. New default value is 100MB
This commit is contained in:
@@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user