File uploading is very basic component of web-development. If you are new in Codelgniter and want to code for file uploading please follow the below code:
//Configure set the path where the files uploaded will be copied. Make sure folder have permission 777
$config['upload_path'] = 'public/uploads/festivals/';
// set the filter image types
$config['allowed_types'] = 'gif|jpg|png|jpeg';
//load the upload library
$this->load->library('upload', $config);
$this->upload->initialize($config);
//if not successful, set the error message
if ($this->upload->do_upload()) {
echo "upload successfully";
}else{
echo $error = array('error' => $this->upload->display_errors());
}
0 Comment(s)