Advertisement
juliarnasution

upload multiple file di codeigniter

Feb 1st, 2020
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.48 KB | None | 0 0
  1. public function upload_foto($data,$no_pendaftaran)
  2.     {  
  3.         $config['upload_path'] = './files/scan_foto' ;
  4.         $config['allowed_types'] = 'jpg|jpeg|png';
  5.         $config['max_size']  = '400';
  6.         $config['remove_space'] = TRUE;
  7.         $config['file_name'] = $data.$no_pendaftaran;
  8.        
  9.         $this->load->library('upload', $config,'foto_upload');
  10.         $this->foto_upload->initialize($config);
  11.         if (!$this->foto_upload->do_upload($data)){
  12.             return array('result'=>FALSE,'file'=>'','error' => $this->foto_upload->display_errors());
  13.         }
  14.         else{
  15.             return array('result'=>TRUE,'file'=>$this->foto_upload->data(),'upload_data' => $this->foto_upload->data());          
  16.         }
  17.     }
  18.  
  19. public function upload_ktp($data,$no_pendaftaran)
  20.     {  
  21.         $config['upload_path'] = './files/scan_ktp' ;
  22.         $config['allowed_types'] = 'jpg|jpeg|png';
  23.         $config['max_size']  = '400';
  24.         $config['remove_space'] = TRUE;
  25.         $config['file_name'] = $data.$no_pendaftaran;
  26.        
  27.         $this->load->library('upload', $config,'ktp_upload');
  28.         $this->ktp_upload->initialize($config);
  29.         if (!$this->ktp_upload->do_upload($data)){
  30.             return array('result'=>FALSE,'file'=>'','error' => $this->ktp_upload->display_errors());
  31.         }
  32.         else{
  33.             return array('result'=>TRUE,'file'=>$this->ktp_upload->data(),'upload_data' => $this->ktp_upload->data());          
  34.         }
  35.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement