[eluser]Computerzworld[/eluser]
I have used CI file uploading code and to check whether the file is valid or not I have displayed error by using $this->validation->display_errors(). But it displays same error twice. Here is the code which I have used.
Code:
if($this->upload->do_upload())
{
$this->mdl_trains->scheduleFile = $_FILES['userfile']['name'];
$this->mdl_trains->scheduleId = $this->scheduleId;
$this->mdl_trains->trainId = $this->trainId;
$this->mdl_trains->saveSchedule();
redirect("admin/trains/trainSchedule/trainId/{$this->trainId}");
}
elseif($_FILES['userfile']['name']!="" && !$this->upload->do_upload())
{
$this->validation->error_string = $this->upload->display_errors();
}
I have assigned the error to $this->validation->error_string. But it displays error twice. How can I solve it? Plz help me. Thanks in advance.