No way to permit empty on file upload |
$Rules['image'] = ['label' => 'Image', 'rules'=>'uploaded[image]|is_image[image]|max_size[image.2048]'];
I am always getting an error for the image that is not an uploaded image file. But i am not uploading any. How can i make this rule permit empty. And only if something was set should validate the rules... I tried with permit_empty, it does not work. It doesn't show any validation errors if i upload a wrong image or exceed max file size or even if i upload another type of file that is not an image...
permit_empty
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
"permit_empty" is a rule for classic field form.
For file uploads, you need to use only Rules for File Uploads The rule to say if the file is required or not is : "uploaded". If the file is required, add the rule : uploaded[file_name]. If it is optional, just do not add this rule. |
Welcome Guest, Not a member yet? Register Sign In |