Add file drag and drop and asynchronous upload

This commit is contained in:
Frederic Guillot
2016-02-13 19:24:36 -05:00
parent 6161eaef9e
commit 738b6ae583
11 changed files with 222 additions and 33 deletions

View File

@@ -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
*