// ---------------------------Validation IMAGE-----------------------------
if (empty($_FILES['package_image']['name']))
{
$this->form_validation->set_rules('package_image','Package Image','required');
}
// ---------------------------Validation IMAGE END-----------------------------
Down
// ---------------------------UPLOAD IMAGE-----------------------------
$config = [
'upload_path' => 'upload/package_image/',
'allowed_types' => 'gif|png|jpg|jpeg|PNG|JPG|JPEG|doc|docx|ppt|pdf|txt',
'overwrite' => false,
'maintain_ratio' => true,
'encrypt_name' => true,
'remove_spaces' => true,
'file_ext_tolower' => true
];
$this->load->library('upload', $config);
if ($this->upload->do_upload('package_image')) {
$data = $this->upload->data();
$image = $config['upload_path'].$data['file_name'];
}
else{
if(!empty($_FILES['package_image']['name'])){
$error = array('error' => $this->upload->display_errors());
$this->session->set_flashdata('exception',$this->upload->display_errors());
}
// redirect('customer/service/security');
}
$userdata['package_image']=(!empty($image)?$image:$this->input->post('package_image'));
// ---------------------------UPLOAD IMAGE END-----------------------------

0 Comments