Advertisement
jamboljack

Func. Updatedata Profil

Sep 19th, 2017
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.94 KB | None | 0 0
  1. public function updatedata() {
  2.         $jam        = time();
  3.         $username   = $this->session->userdata('username');
  4.        
  5.         if (!empty($_FILES['foto_file']['name'])) {
  6.             $config['file_name']        = 'Avatar_'.$kode.'_'.$jam.'.jpg';
  7.             $config['upload_path']      = './img/icon/';
  8.             $config['allowed_types']    = 'jpg|png|gif|jpeg';
  9.             $config['overwrite']        = TRUE;
  10.             $config['max_size']         = 0;
  11.             $this->load->library('upload', $config);
  12.  
  13.             if (!$this->upload->do_upload('foto_file')) {
  14.                 // Pesan Gagal
  15.  
  16.             } else {
  17.                 $this->upload->do_upload('fileattach');
  18.                 $config['image_library']    = 'gd2';
  19.                 $config['source_image']     = $this->upload->upload_path.$this->upload->file_name;
  20.                 $config['maintain_ratio']   = TRUE;
  21.                 $this->load->library('image_lib',$config);               
  22.                 $this->image_lib->resize();
  23.                
  24.                 $this->profile_m->update_data();
  25.             }
  26.         } else {
  27.             $this->profile_m->update_data();
  28.         }
  29.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement