Reputation: 313
I use this code in my entity class:
/**
* @Assert\File(maxSize="8388608", maxSizeMessage="8 MB please")
*/
protected $imageFile;
or this one:
/**
* @Assert\Image(maxSize="8M", maxSizeMessage="8 MB please")
*/
protected $imageFile;
But all i get is this error, when uploading a 5 MB file:
The file is too large. Allowed maximum size is 2097152 bytes.
My configuration is just ignored. Weird is that 'mimeTypesMessage=…' is working when i use it in the above examples. This means validation in general is working except of the maxSize/maxSizeMessage stuff.
Any suggestions how to fix this?
Upvotes: 2
Views: 2143
Reputation: 313
It is indeed the 'upload_max_filesize' in php.ini which causes this weird behaviour. After setting this to 10M everything worked fine (including the customized error message).
Upvotes: 4