1<?php
2
3class Form extends CI_Controller {
4
5 public function index()
6 {
7 $this->load->helper(array('form', 'url'));
8
9 $this->load->library('form_validation');
10
11 if ($this->form_validation->run() == FALSE)
12 {
13 $this->load->view('myform');
14 }
15 else
16 {
17 $this->load->view('formsuccess');
18 }
19 }
20}
21
1if (empty($_FILES['userfile']['name']))
2{
3 $this->form_validation->set_rules('userfile', 'Image', 'required');
4}