summaryrefslogtreecommitdiffstats
path: root/system/application/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'system/application/helpers')
-rw-r--r--system/application/helpers/filebin_helper.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/system/application/helpers/filebin_helper.php b/system/application/helpers/filebin_helper.php
new file mode 100644
index 000000000..34b231023
--- /dev/null
+++ b/system/application/helpers/filebin_helper.php
@@ -0,0 +1,9 @@
+<?php
+
+// Source: http://ibnuyahya.com/format-bytes-to-kb-mb-gb/
+function format_bytes($size, $precision = 2){
+ $base = log($size) / log(1024);
+ $suffixes = array('B', 'kB', 'MB', 'GB', 'TB' , 'PB' , 'EB');
+ return round(pow(1024, $base - floor($base)), $precision) . $suffixes[floor($base)];
+}
+