Support the ongoing development of →
Eloquent Forms Validation
Last updated 1 year ago.

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.

Last updated 1 year ago.

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 UploadedFile class.

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.

Last updated 1 year ago.

Sign in to participate in this thread!

Full Stack Europe

Your banner here too?

agjmills agjmills Joined 24 Jul 2014


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2023 - All rights reserved.