summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/application/controllers/file.php3
-rw-r--r--system/application/helpers/filebin_helper.php9
-rw-r--r--system/application/views/file/upload_form.php4
3 files changed, 14 insertions, 2 deletions
diff --git a/system/application/controllers/file.php b/system/application/controllers/file.php
index 67f7c0b2e..8584948b9 100644
--- a/system/application/controllers/file.php
+++ b/system/application/controllers/file.php
@@ -13,7 +13,7 @@ class File extends Controller {
function __construct()
{
parent::Controller();
- $this->load->helper('form');
+ $this->load->helper(array('form', 'filebin'));
$this->load->model('file_mod');
$this->var->cli_client = false;
$this->file_mod->var->cli_client =& $this->var->cli_client;
@@ -47,6 +47,7 @@ class File extends Controller {
{
$data = array();
$data['title'] = 'Upload';
+ $data['small_upload_size'] = $this->config->item('small_upload_size');
$this->load->view('file/header', $data);
$this->load->view('file/upload_form', $data);
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)];
+}
+
diff --git a/system/application/views/file/upload_form.php b/system/application/views/file/upload_form.php
index ac4789770..300fa7558 100644
--- a/system/application/views/file/upload_form.php
+++ b/system/application/views/file/upload_form.php
@@ -12,7 +12,9 @@
</form>
</div>
<br /><br />
-<p>Uploads/pastes are deleted after 5 days.</p>
+<p>Uploads/pastes are deleted after 5 days<?php if($small_upload_size > 0): ?>
+ unless they are smaller than <?php echo format_bytes($small_upload_size); ?>
+<?php endif; ?>.</p>
<br />
<p>For shell uploading/pasting use:</p>
<pre>