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

This commit is contained in:
Dongsheng Cai 2009-12-15 08:00:11 +00:00
parent 75b1018cd3
commit 6926df754e
2 changed files with 3 additions and 2 deletions

View file

@ -164,6 +164,7 @@ class repository_local extends repository {
$ret['itemid'] = $itemid;
$ret['title'] = $title;
$ret['contextid'] = $user_context->id;
$ret['filesize'] = $file_info->get_filesize();
return $ret;
}

View file

@ -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');