Add different config’s for different file uploads in codeigniter.
Follow example:
<?php public function insert_file(){ $config['upload_path'] = './assets/images'; $config['allowed_types'] = '*'; $this->load->library('upload', $config); $this->upload->do_upload('my_image_file_name'); $file_banner = $this->upload->data(); unset($config); $my_image_file_name2 = $_FILES['my_image_file_name2']['name']; $config['upload_path'] = './assets/images/'; $config['allowed_types'] = 'gif|jpg|jpeg|png'; $config['max_size'] = 2048; $config['max_width'] = 2024; $config['max_height'] = 2024; $this->upload->initialize($config); $this->upload->do_upload('my_image_file_name2'); unset($config); $my_image_file_name3 = $_FILES['my_image_file_name3']['name']; $config['upload_path'] = './assets/images/'; $config['allowed_types'] = 'gif|jpg|jpeg|png'; $config['max_size'] = 2048; $config['max_width'] = 2024; $config['max_height'] = 2024; $this->upload->initialize($config); $this->upload->do_upload('my_image_file_name3'); $data=array('my_image_file_name'=>$my_image_file_name['file_name'],'my_image_file_name2'=>$my_image_file_name2,'my_image_file_name3'=>$my_image_file_name3); $this->db->insert('table name',$data); } ?>
Question and answer is powered by AnsPress.io