1
0
mirror of https://github.com/moodle/moodle.git synced 2025-04-24 01:44:27 +02:00

Merge branch 'MDL-69257-master' of git://github.com/mihailges/moodle

This commit is contained in:
Jun Pataleta 2020-10-09 11:12:23 +08:00
commit fac0b05ed5

@ -78,6 +78,17 @@ switch ($action) {
$token = required_param('token', PARAM_RAW);
$contentid = required_param('contentId', PARAM_INT);
$maxsize = get_max_upload_file_size($CFG->maxbytes);
// Check size of each uploaded file and scan for viruses.
foreach ($_FILES as $uploadedfile) {
$filename = clean_param($uploadedfile['name'], PARAM_FILE);
if ($uploadedfile['size'] > $maxsize) {
H5PCore::ajaxError(get_string('maxbytesfile', 'error', ['file' => $filename, 'size' => display_size($maxsize)]));
return;
}
\core\antivirus\manager::scan_file($uploadedfile['tmp_name'], $filename, true);
}
$editor->ajax->action(H5PEditorEndpoints::FILES, $token, $contentid);
break;