Commit 6926df75 authored by Dongsheng Cai's avatar Dongsheng Cai
Browse files

"MDL-21102, fixed fatal php error in file picker"

parent 75b1018c
......@@ -158,12 +158,13 @@ class repository_local extends repository {
$filename = $params['filename'];
$fileitemid = $params['itemid'];
$context = get_context_instance_by_id($contextid);
$file_info = $browser->get_file_info($context, $filearea, $fileitemid, $filepath, $filename);
$file_info = $browser->get_file_info($context, $filearea, $fileitemid, $filepath, $filename);
$file_info->copy_to_storage($user_context->id, 'user_draft', $itemid, $save_path, $title);
$ret['itemid'] = $itemid;
$ret['title'] = $title;
$ret['contextid'] = $user_context->id;
$ret['filesize'] = $file_info->get_filesize();
return $ret;
}
......
......@@ -237,7 +237,7 @@ EOD;
$info['file'] = $fileinfo['title'];
$info['id'] = $itemid;
$info['url'] = $CFG->httpswwwroot.'/draftfile.php/'.$fileinfo['contextid'].'/user_draft/'.$itemid.'/'.$fileinfo['title'];
$filesize = $fileinfo->get_filesize();
$filesize = $fileinfo['filesize'];
if (($maxbytes!==-1) && ($filesize > $maxbytes)) {
$fileinfo->delete();
throw new file_exception('maxbytes');
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment