From b817205becfb8716bab7849fa7bf0c240d91920e Mon Sep 17 00:00:00 2001 From: Dongsheng Cai Date: Thu, 30 Sep 2010 03:36:38 +0000 Subject: [PATCH] MDL-24382, fixed display of file size limit in filepicker --- lib/form/filepicker.php | 1 + lib/outputrenderers.php | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/form/filepicker.php b/lib/form/filepicker.php index 1c590486fab..5dc2b3159a0 100644 --- a/lib/form/filepicker.php +++ b/lib/form/filepicker.php @@ -75,6 +75,7 @@ class MoodleQuickForm_filepicker extends HTML_QuickForm_input { $args->accepted_types = $this->_options['accepted_types']?$this->_options['accepted_types']:'*'; $args->return_types = FILE_INTERNAL; $args->itemid = $draftitemid; + $args->maxbytes = $this->_options['maxbytes']; $args->context = $PAGE->context; $html = $this->_getTabs(); diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php index 0e5687b16e0..3a3d7e4dcfa 100644 --- a/lib/outputrenderers.php +++ b/lib/outputrenderers.php @@ -1914,7 +1914,12 @@ class core_renderer extends renderer_base { if (empty($currentfile)) { $currentfile = get_string('nofilesattached', 'repository'); } - $maxsize = get_string('maxfilesize', 'moodle', display_size(get_max_upload_file_size())); + if ($options->maxbytes) { + $size = $options->maxbytes; + } else { + $size = get_max_upload_file_size(); + } + $maxsize = get_string('maxfilesize', 'moodle', display_size($size)); $html = << $icon_progress