php - strrpos() expects parameter 1 to be string, array given -


i trying use upload library of codeigniter keep on getting error:

a php error encountered  severity: warning  message: strrpos() expects parameter 1 string, array given  filename: libraries/upload.php  line number: 1178  backtrace:  file: c:\xampp\htdocs\schoolportal\application\controllers\studentaffairs.php line: 207 function: do_upload  file: c:\xampp\htdocs\schoolportal\index.php line: 292 function: require_once 

i don't know what's error because copied same code in other function of same controller, 1 working.

here sample of code in controller:

            $img_name = $this->infomodel->getfirstnullannouncement();              $config['upload_path']          = './images/';             $config['allowed_types']        = 'gif|jpg|png';             $config['max_size']             = 5000;             $config['max_width']            = 3000;             $config['max_height']           = 4000;             $config['overwrite']            = true;             $config['file_name']            = $img_name;              $this->load->library('upload', $config);             $this->upload->initialize($config);              $img = "userfile";              $id = $this->session->userdata('id');             $user['user'] = $this->usersmodel->select_student_affairs($id);              if (!$this->upload->do_upload($img)){                 $data['error'] = $this->upload->display_errors();                  $this->load->view('include/header_student_affairs',$user);                 $this->load->view('studentaffairs/add_announcement', $data);                 $this->load->view('include/footer_student_affairs');             } else {                 $img_path = 'images/'.$this->upload->data('orig_name');                 $data['success'] = 'announcement has been updated.';                 $data['announcements'] = $this->infomodel->getannouncements();                 $data['announcenum'] = $this->infomodel->getannouncementcount();                  $this->infomodel->updateannouncement($img_path);                  $imgdata = $this->upload->data();                 $thumbnail = $imgdata['raw_name'].'_thumb'.$imgdata['file_ext'];                 $this->createthumbnail($img_path, $img_id, $thumbnail);                  $this->load->view('include/header_student_affairs',$user);                 $this->load->view('studentaffairs/announcements', $data);                 $this->load->view('include/footer_student_affairs');             } 

line 207 one:

if (!$this->upload->do_upload($img)){ 

the $this->upload->display_errors(); produces error: the filetype attempting upload not allowed.

please help

maybe extension of file upload .jpeg not on list of $config['allowed_types']..


Comments