Support the ongoing development of Laravel.io →
Eloquent Forms Validation
Last updated 2 years ago.
0

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 2 years ago.
0

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 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

agjmills agjmills Joined 24 Jul 2014

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.