You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
I have a double file size validation when file is beyond the 'upload_max_filesize' parameter.
In this case the max size is set to 500ko in the form and the max size allowed by php 2mo. Additionally the error message isn't translated.
How to reproduce
/**
* Add or edit the avatar.
*/
class AvatarFormType extends AbstractType
{
private const IMAGE_MAX_SIZE = 512000;
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add('avatar', FileType::class, [
'required' => true,
'constraints' => [
new NotBlank(),
new Image([
'maxSize' => self::IMAGE_MAX_SIZE,
]),
],
]);
}
}
and php setting :
upload_max_filesize | 2M | 2M
Possible Solution
Detect if a maxSize constraint already exists and is below the upload_max_filesize value?