コード例 #1
0
ファイル: backend.php プロジェクト: Goyz/roger_danuarta
 function upload($modul, $id_header, $postnya = "")
 {
     $upload = new lib();
     //print_r ($upload->uploadmultiplenong('__repository/product/'));exit;
     $path = '__repository/' . $this->input->post('upload_na') . '/';
     $file_name = $upload->uploadmultiplenong($path);
     $sts = 1;
     if (count($file_name) > 0) {
         foreach ($file_name as $x) {
             switch ($modul) {
                 case "tbl_product_foto":
                     $post = array('tbl_product_id' => $id_header, 'file_foto' => $x, 'flag' => 1);
                     if ($this->input->post('sts_crud') == 'edit') {
                         $path = '__repository/product/';
                         //$this->mbackend->hapus_foto('tbl_product_foto',$path,'tbl_product_id',$id_header,'file_foto');
                         unset($_POST['sts_crud']);
                         $_POST['sts_crud'] = 'add';
                     }
                     break;
                 case "tbl_services_foto":
                     $post = array('tbl_services_id' => $id_header, 'file_foto' => $x, 'flag' => 1);
                     if ($this->input->post('sts_crud') == 'edit') {
                         $path = '__repository/services/';
                         //echo $id_header;exit;
                         //$this->mbackend->hapus_foto('tbl_services_foto',$path,'tbl_services_id',$id_header,'file_foto');
                         unset($_POST['sts_crud']);
                         $_POST['sts_crud'] = 'add';
                     }
                     break;
                 case "tbl_gallery":
                     $post = array('cl_lokasi_id' => $postnya['cl_lokasi_id'], 'file_foto' => $x, 'flag' => 1);
                     break;
                 case "tbl_banner":
                     $post = array('file_banner' => $x, 'status' => 1);
                     break;
             }
             if ($this->mbackend->simpan_data($modul, $post)) {
                 $sts = 1;
             }
         }
     }
     return $sts;
 }