#13342 Validation is added on file upload so that it meets the value of the Collection Size token

This commit is contained in:
Jorge Rincon 2024-05-06 13:44:57 +02:00
parent c84999a5fa
commit 5813e63798
1 changed files with 13 additions and 0 deletions

View File

@ -120,6 +120,19 @@ function upload_file($upload_file_or_zip, $default_real_directory, $destination_
$upload_zip = (bool) get_parameter('upload_zip');
}
// Validate file size vs collection_max_size token.
if ($_FILES['file']['size'] > (int) $config['collection_max_size']) {
$upload_file = false;
$config['filemanager']['message'] = ui_print_error_message(
__(
'File of collection is bigger than the limit (%s bytes)',
$config['collection_max_size'],
'',
true
)
);
}
// Upload file.
if ($upload_file === true) {
if (isset($_FILES['file']) === true && empty($_FILES['file']['name']) === false) {