File Upload in CodeIgniter with Input Field

In this post, I will tell you How To File upload in codeigniter with input field?
Here is the working code :

<input type=”file” name=”filename” size=”20 />

First load the upload library:

$this->load->library(‘upload’, $config);
Then upload your file

if ( $this->upload->do_upload(‘filename’))
$data = array(‘upload_data’ => $this->upload->data());
// $data will contain your file information


For more details, visit the link