mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 17:06:53 +02: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
1 changed files with 1 additions and 1 deletions
|
@ -75,10 +75,10 @@ switch ($action) {
|
||||||
$token = required_param('token', PARAM_RAW);
|
$token = required_param('token', PARAM_RAW);
|
||||||
$contentid = required_param('contentId', PARAM_INT);
|
$contentid = required_param('contentId', PARAM_INT);
|
||||||
|
|
||||||
|
$maxsize = get_max_upload_file_size($CFG->maxbytes);
|
||||||
// Check size of each uploaded file and scan for viruses.
|
// Check size of each uploaded file and scan for viruses.
|
||||||
foreach ($_FILES as $uploadedfile) {
|
foreach ($_FILES as $uploadedfile) {
|
||||||
$filename = clean_param($uploadedfile['name'], PARAM_FILE);
|
$filename = clean_param($uploadedfile['name'], PARAM_FILE);
|
||||||
$maxsize = get_max_upload_file_size($CFG->maxbytes);
|
|
||||||
if ($uploadedfile['size'] > $maxsize) {
|
if ($uploadedfile['size'] > $maxsize) {
|
||||||
H5PCore::ajaxError(get_string('maxbytesfile', 'error', ['file' => $filename, 'size' => display_size($maxsize)]));
|
H5PCore::ajaxError(get_string('maxbytesfile', 'error', ['file' => $filename, 'size' => display_size($maxsize)]));
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue