I will try to upload an Excel file and verify its contents.
So I tried the code as below.
if ($this->upload->do_upload("filename"))
{
...
// I Think it is idiot code . . but . . anyway . . :_(
$_POST = array(
"name" => $cell[0],
"phone" => $cell[1],
"birth" => $cell[2],
...
);
$config = array(
array("field"=>"name", "label"=>"Name", "rule"=> "required"),
...
);
$this->form_validation->set_rules($config);
$this->form_validation->set_error_delimiters('', '');
if ($this->form_validation->run() === false)
{
throw new Exception($this->form_validation->error_string());
}
...
}
How to validate custom data using form_validation?