CodeIgniter Forums
CI4 "required" rule fails despite form field has a value! - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11)
+--- Thread: CI4 "required" rule fails despite form field has a value! (/showthread.php?tid=80658)



CI4 "required" rule fails despite form field has a value! - BlackBones - 11-28-2021

Hello CI gods.
I have run into a situation with form validation in CI4.
My file upload form worked perfectly about a little while ago. The "required" validation rule fails for an image file input despite choosing an image file that conforms with my upload rules, and therefore upload fails. On submitting the upload form, the file input field errors out with "field is required" notification.
If I remove the "required" rule from my config file for the particular class/method processing upload data, the form is successfully submitted.
I have checked over and over and it's not working and I seem to not be able to figure out what the problem might be.
Any help would be greatly appreciated.
Thanks.


RE: CI4 "required" rule fails despite form field has a value! - kenjis - 11-28-2021

What did you change?


RE: CI4 "required" rule fails despite form field has a value! - kenjis - 11-29-2021

required can't be used for uploaded file.


RE: CI4 "required" rule fails despite form field has a value! - InsiteFX - 11-30-2021

@kenjis Maybe add that information to the CodeIgniter Users Guide for uploaded files.


RE: CI4 "required" rule fails despite form field has a value! - kenjis - 11-30-2021

@InsiteFX Thanks!

I added it to the PR:
https://github.com/codeigniter4/CodeIgniter4/pull/5411