Validate file inside controller in Codeigniter4 |
Hello,
I'm trying to create a simple HTML form with one input field which accept one file (csv,xlsx) and i will process it and insert into my database. I need to validate the file with two things 1. the file type should be .csv or .xlsx 2. required filed 3. size should be less than 1 mb My Controller Function : Code: Public function bulkUpload() { My Form : Code: <?php echo form_open_multipart('dashboard/employees/bulk-upload'); ?> But the problem, i'm unable to validate here, this always give me error. Anyone can help me how i can validate this file inside the controler and show the error message in my view ?
(03-19-2024, 10:30 PM)kenjis Wrote: See https://codeigniter4.github.io/CodeIgnit...he-process Thanks, I got it. But how i can set custom validation error message for this rule Code: $rules = [
CodeIgniter 4 User Guide - Validation - Setting Custom Error Messages
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |