Index: branches/5.2.x/core/kernel/utility/formatters/upload_formatter.php =================================================================== diff -u -N -r16574 -r16576 --- branches/5.2.x/core/kernel/utility/formatters/upload_formatter.php (.../upload_formatter.php) (revision 16574) +++ branches/5.2.x/core/kernel/utility/formatters/upload_formatter.php (.../upload_formatter.php) (revision 16576) @@ -1,6 +1,6 @@ Application->getUnitOption($object->Prefix, 'BasePath'); $field_options['upload_dir'] = WRITEBALE_BASE . '/' . basename($base_path) . '/'; } + + if ( !isset($field_options['max_size']) ) { + $field_options['max_size'] = MAX_UPLOAD_SIZE; + } } /** @@ -210,8 +214,6 @@ if ( is_array($value) && count($value) > 1 && $value['size'] ) { if ( is_array($value) && (int)$value['error'] === UPLOAD_ERR_OK ) { - $max_file_size = isset($options['max_size']) ? $options['max_size'] : MAX_UPLOAD_SIZE; - // we can get mime type based on file content and don't use one, provided by the client // $value['type'] = kUtil::mimeContentType($value['tmp_name']); @@ -233,7 +235,7 @@ $object->SetError($field_name, 'bad_file_format', 'la_error_InvalidFileFormat', $error_params); } - elseif ( $value['size'] > $max_file_size ) { + elseif ( $value['size'] > $options['max_size'] ) { $object->SetError($field_name, 'bad_file_size', 'la_error_FileTooLarge'); } elseif ( !is_writable($this->FullPath) ) {