Skip to content

Commit

Permalink
Merge branch 'MDL-69257-310' of git://github.com/mihailges/moodle int…
Browse files Browse the repository at this point in the history
…o MOODLE_310_STABLE
  • Loading branch information
junpataleta committed Oct 9, 2020
2 parents b2a3820 + 0305839 commit 05a3e35
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 05a3e35

Please sign in to comment.