ci from validation code example
Example 1: codeigniter form_validation email
$this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email');
Example 2: file form validation codeigniter
if (empty($_FILES['userfile']['name']))
{
$this->form_validation->set_rules('userfile', 'Image', 'required');
}