It wont pass the validator unless you pass the filesize of the file you are "uploading" into the constructor of the Symfony\Component\HttpFoundation\UploadedFile class
However now the error that is received is: The file "18233.jpg" was not uploaded due to an unknown error.
You can't just instantiate the UploadedFile class like that. Part of the validation will check whether the file is actually an uploaded file using
is_uploaded_file. However, whilst the validator requires an instance of
File, it uses methods only available on the
So essentially there's a bug in the validator, which will stop you manually init'ing a File class and using it with image validation (i've submitted a pull request with a fix, but with 100+ other active PR's, might be a while until Taylor gets around to checking it out and either accepting it, or telling me he doesn't like the fix).
In the meantime, you have the usual options. You can wait, you can maintain your own fixed fork for a while, you can remove the validation, or create a custom image validator rather than using the inbuilt one.
Sign in to participate in this thread!
We'd like to thank these amazing companies for supporting us