From 7d4855d2b0307e836c3463030407520e2e0c981c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Bla=C5=BEek?= Date: Wed, 25 Oct 2017 11:00:59 +0200 Subject: [PATCH 1/2] maxSize uses value in MB --- bundle/Form/FieldTypeHandler/EnhancedFile.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundle/Form/FieldTypeHandler/EnhancedFile.php b/bundle/Form/FieldTypeHandler/EnhancedFile.php index 0ccc8d9..73b1e47 100644 --- a/bundle/Form/FieldTypeHandler/EnhancedFile.php +++ b/bundle/Form/FieldTypeHandler/EnhancedFile.php @@ -72,7 +72,7 @@ protected function buildFieldForm( $constraints = array(); if (false !== $maxFileSize) { - $constraints['maxSize'] = $maxFileSize; + $constraints['maxSize'] = strval($maxFileSize) . "M"; } if (!empty($allowedExtensions)) { From 2a070aadbb3ec7f1d26fba3fa58dd8863013d40a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Bla=C5=BEek?= Date: Wed, 25 Oct 2017 11:11:43 +0200 Subject: [PATCH 2/2] can be NULL --- bundle/Form/FieldTypeHandler/EnhancedFile.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundle/Form/FieldTypeHandler/EnhancedFile.php b/bundle/Form/FieldTypeHandler/EnhancedFile.php index 73b1e47..b04f7f7 100644 --- a/bundle/Form/FieldTypeHandler/EnhancedFile.php +++ b/bundle/Form/FieldTypeHandler/EnhancedFile.php @@ -71,7 +71,7 @@ protected function buildFieldForm( if (false !== $maxFileSize || !empty($allowedExtensions)) { $constraints = array(); - if (false !== $maxFileSize) { + if (false !== $maxFileSize && !empty($maxFileSize)) { $constraints['maxSize'] = strval($maxFileSize) . "M"; }