Upload does not validate quantity and size
Hello everybody. Guys, I have an UploadFile component configured to receive only one file and a maximum of 100Kb, but when I test it, it is not being validated. It allows more than 1 file and any size. Does anyone know what can it be?
4 Replies
Please don't tag people.
File size validation doesn't get triggered until the form is submitted, so a user can upload a file that is larger, but it won't get stored permanently and the form won't save unless they change the uploaded file.
The reason you are getting multiple files allowed is because you are adding these to the field:
The field is only one upload by default, so you don't need any of that if you want to only allow one file.
I apologize for tagging Dan. I've already tried to find an answer to this in several other ways and haven't found it. I will remove the tag.
Now about setting maxfiles = 1, it's just to test whether it would crash with more than one upload. But in this field there will certainly be higher values because it is a limited gallery of images.
Regarding validation, it actually works after submitting the form, but I have another project with version V2.17 and there it validates everything in real time. See the attached images. That's why I have this doubt. Did the behavior change in version 3?
Thanks.
Solution
It could be a bug. Feel free to submit an issue on GitHub. π
ok. Thanks