Welcome Guest, Not a member yet? Register   Sign In
validation in the file model
#1

I need to validate files using codeigniter 4 and when placing validation rules, I also need to allow empty, but when using the "permit empty" rule it ignores all other rules.
'course' => 'permit_empty|max_size[course,2000]|ext_in[pdf,tar,zip]'
Reply
#2

See the note at the end.
https://codeigniter4.github.io/userguide...le-uploads
Reply
#3

Ok, I saw this note, but is there no other way?
Reply
#4

(This post was last modified: 11-16-2023, 03:14 PM by kenjis.)

In conclusion, only Rules for File Uploads should be used for uploaded files. Otherwise, you will not get the expected results.

If the existing rules do not work for you, create a custom rule.

Quote:uploaded
...
If you want the file upload to be optional
(not required), do not define this rule.
https://codeigniter4.github.io/userguide...le-uploads
Reply




Theme © iAndrew 2016 - Forum software by © MyBB