Closed
Description
Q | A |
---|---|
Bug report? | no |
Feature request? | yes |
BC Break report? | no |
RFC? | no |
Symfony version | 3.4.4 |
If an uploaded file encounter an error, a FileException
instance like this is thrown:
The file "5MB.zip" exceeds your upload_max_filesize ini directive (limit is 2048 KiB).
The message template is choose thanks to this code part:
symfony/src/Symfony/Component/HttpFoundation/File/UploadedFile.php
Lines 259 to 265 in a8dc953
The issue is we don't have any access to the related PHP constant and we have to check the exception compare with string comparison which is not really reliable.
Two solutions:
- The simplest one: Add the PHP error constant on the
FileException
to make it accessible from the catch. - The best (IMO): Create new exception based on the PHP error constant such as
IniSizeFileException
orFormSizeFileException
.
What do you think?