diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-02-13 19:24:36 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-02-13 19:24:36 -0500 |
commit | 738b6ae5832fb7c2992ec0dc52399e4dbf3d096d (patch) | |
tree | 25ebca2f9d6dd6ba8f5431644fdc6b8ff91ac34d /app/Helper/Text.php | |
parent | 6161eaef9e107ddbfc104753eb5d48434de3b824 (diff) |
Add file drag and drop and asynchronous upload
Diffstat (limited to 'app/Helper/Text.php')
-rw-r--r-- | app/Helper/Text.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/app/Helper/Text.php b/app/Helper/Text.php index 59bfd997..83f1e3f9 100644 --- a/app/Helper/Text.php +++ b/app/Helper/Text.php @@ -43,6 +43,29 @@ class Text extends 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 * * @param string $haystack Haystack |