You can try this code:-
<?php $path = $_FILES['img_name']['name']; $ext = pathinfo($path, PATHINFO_EXTENSION); $image = time() ."new_image_name".".".$ext; $img_name = $image; $config['upload_path'] = './assets/backend/images/'; $config['allowed_types'] = 'gif|jpg|jpeg|png'; $config['file_name'] = $image; $this->load->library('upload', $config); $this->upload->do_upload('img_name'); ?>
This code is worked.
Question and answer is powered by AnsPress.io