public function uploadImage($page, $id) { $fields = ['hotel_id', 'photo_name']; $oldImage = []; $res = $this->content->selectField('panel_hotel_photo', ['photo_name'], '', 0, 'hotel_id', '' . $id . '', 'id', ''); foreach ($res->result_array() as $row) { $oldImage[] = $row['photo_name']; } if (isset($_POST['submit'])) { print_r($_POST); die; $fields = ['hotel_id', 'photo_name']; $code = uniqid(); $upload = new Uploads(); $return = $upload->upfile($code); foreach ($return['image'] as $key => $ret) { $values[] = [$id, "'{$ret}'"]; } $this->content->addRecord2('panel_hotel_photo', $fields, $values); // foreach ($return as $ret){ // $this->content->addRecord(); // } } $content = $this->content->uploadImage($page, $id, $oldImage); $data['content'] = $content; $subTitle = $this->tools->subTitleGenerator('upload_image', $page, $this->fWhere, $this->where); $pageDetail = $this->tools->page_detail($page); $data['title2'] = ' '; $data['pagination'] = ''; $data['action'] = 'edit'; //$data['menu'] = $this->menu; $this->loadHeader($pageDetail, $subTitle); $this->loadMenu(); $this->load->view('admin/view', $data); $this->loadFooter(); }