mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
MDL-69257 core_h5p: Move $maxsize outside the foreach loop
There is no reason to repeatedly obtain the maximum size for uploading files as a part of foreach loop.
This commit is contained in:
parent
2355205ad8
commit
2212df5dd8
@ -75,10 +75,10 @@ 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);
|
||||
$maxsize = get_max_upload_file_size($CFG->maxbytes);
|
||||
if ($uploadedfile['size'] > $maxsize) {
|
||||
H5PCore::ajaxError(get_string('maxbytesfile', 'error', ['file' => $filename, 'size' => display_size($maxsize)]));
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user