mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 15:05:42 +00:00
FIX incorrect calculation of MAX_FILE_SIZE (#600)
* Fixes incorrect calculation of MAX_FILE_SIZE * Fixes expected bytes in EditableFileFiled test
This commit is contained in:
parent
6fd952c737
commit
ec2b012eed
@ -93,7 +93,7 @@ class EditableFileField extends EditableFormField
|
|||||||
);
|
);
|
||||||
|
|
||||||
if ($this->MaxFileSizeMB > 0) {
|
if ($this->MaxFileSizeMB > 0) {
|
||||||
$field->getValidator()->setAllowedMaxFileSize($this->MaxFileSizeMB * 1024);
|
$field->getValidator()->setAllowedMaxFileSize($this->MaxFileSizeMB * 1024 * 1024);
|
||||||
} else {
|
} else {
|
||||||
$field->getValidator()->setAllowedMaxFileSize(static::get_php_max_file_size());
|
$field->getValidator()->setAllowedMaxFileSize(static::get_php_max_file_size());
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ class EditableFileFieldTest extends SapphireTest
|
|||||||
$fileField->write();
|
$fileField->write();
|
||||||
|
|
||||||
$formField = $fileField->getFormField();
|
$formField = $fileField->getFormField();
|
||||||
$this->assertEquals($formField->getValidator()->getAllowedMaxFileSize(), 256);
|
$this->assertEquals($formField->getValidator()->getAllowedMaxFileSize(), 262144);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user