Skip to content

Commit

Permalink
Merge branch 'MDL-69257-master' of git://github.com/mihailges/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
junpataleta committed Oct 9, 2020
2 parents 56be458 + 2212df5 commit fac0b05
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions h5p/ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,17 @@
$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;

Expand Down

0 comments on commit fac0b05

Please sign in to comment.