mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
FIX correctly calculate MaxFileSizeMB
The inputted value is intended to represent megabytes, but is only multiplied by 1024 - meaning it'd represent kilobytes. This is then used to compare with the PHP setting number, which is bytes in the range of megabytes. Kilobytes are always under megabytes, meaning size comparisons elsewhere in the code are always true. We should ensure the calculation for validation is correct.
This commit is contained in:
parent
42df67fe76
commit
0ce94b75f5
@ -185,7 +185,7 @@ class EditableFileField extends EditableFormField
|
||||
$result = parent::validate();
|
||||
|
||||
$max = static::get_php_max_file_size();
|
||||
if ($this->MaxFileSizeMB * 1024 > $max) {
|
||||
if ($this->MaxFileSizeMB * 1024 * 1024 > $max) {
|
||||
$result->addError("Your max file size limit can't be larger than the server's limit of {$this->getPHPMaxFileSizeMB()}.");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user