Add file drag and drop and asynchronous upload
This commit is contained in:
@@ -42,6 +42,29 @@ class Text extends Base
|
||||
return round(pow(1024, $base - floor($base)), $precision).$suffixes[(int)floor($base)];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of bytes from PHP size
|
||||
*
|
||||
* @param integer $val PHP size (example: 2M)
|
||||
* @return integer
|
||||
*/
|
||||
public function phpToBytes($val)
|
||||
{
|
||||
$val = trim($val);
|
||||
$last = strtolower($val[strlen($val)-1]);
|
||||
|
||||
switch ($last) {
|
||||
case 'g':
|
||||
$val *= 1024;
|
||||
case 'm':
|
||||
$val *= 1024;
|
||||
case 'k':
|
||||
$val *= 1024;
|
||||
}
|
||||
|
||||
return $val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if needle is contained in the haystack
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user