CodeIgniter Forums
Codeigniter form validation for file - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Choosing CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=8)
+--- Thread: Codeigniter form validation for file (/showthread.php?tid=82629)



Codeigniter form validation for file - DennisSSebasiStephen - 08-02-2022

I'm using codeigniter for my project and I need to read contents of files. So,I need validation to check whether the file is selected or not.

Here is my code in controller

$this->form_validation->set_rules(
  'estimation_file',
  'Project Estimation File',
  'required'
);
But while choosing a file it shows error saying - The Project Estimation File field is required



RE: Codeigniter form validation for file - ozornick - 08-03-2022

Need more information.

Have you set the correct form format? enctype='multipart/form-data'
Perhaps required is not suitable for file validation, use 'uploaded'