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:
Reece Alexander 2017-05-24 16:31:25 +10:00 committed by Damian Mooyman
parent 6fd952c737
commit ec2b012eed
2 changed files with 2 additions and 2 deletions

View File

@ -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());
} }

View File

@ -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);
} }
} }