"MDL-13766, fixed maxbytes limit"
authorDongsheng Cai <unoter@gmail.com>
Mon, 8 Mar 2010 16:49:51 +0000 (16:49 +0000)
committerDongsheng Cai <unoter@gmail.com>
Mon, 8 Mar 2010 16:49:51 +0000 (16:49 +0000)
lib/form/filemanager.php
repository/filepicker.js
repository/repository_ajax.php

index 270b0fc..ca00ee6 100644 (file)
@@ -42,7 +42,7 @@ class MoodleQuickForm_filemanager extends HTML_QuickForm_element {
                 $this->_options[$name] = $value;
             }
         }
-        if (!empty($options['maxbytes'])) {
+        if (empty($options['maxbytes'])) {
             $this->_options['maxbytes'] = get_max_upload_file_size($CFG->maxbytes, $options['maxbytes']);
         }
         parent::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
@@ -152,7 +152,7 @@ class MoodleQuickForm_filemanager extends HTML_QuickForm_element {
 
         $options = file_get_draft_area_files($draftitemid);
         $options->mainfile  = $this->_options['mainfile'];
-        $options->maxbytes  = $this->getMaxbytes();
+        $options->maxbytes  = $this->_options['maxbytes'];
         $options->maxfiles  = $this->getMaxfiles();
         $options->client_id = $client_id;
         $options->filecount = $filecount;
index cc3bd0a..fc84df9 100644 (file)
@@ -95,6 +95,7 @@ M.core_filepicker.init = function(Y, options) {
             params['sesskey']=M.cfg.sesskey;
             params['client_id'] = args.client_id;
             params['itemid'] = this.options.itemid?this.options.itemid:0;
+            params['maxbytes'] = this.options.maxbytes?this.options.maxbytes:-1;
             if (args['params']) {
                 for (i in args['params']) {
                     params[i] = args['params'][i];
index 3eb4955..df143c0 100755 (executable)
@@ -270,7 +270,7 @@ EOD;
             break;
         case 'upload':
             try {
-                $result = $repo->upload();
+                $result = $repo->upload($maxbytes);
                 $result['client_id'] = $client_id;
                 echo json_encode($result);
             } catch (Exception $e){