Guest User

Untitled

a guest
Feb 20th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.00 KB | None | 0 0
  1.     function editProfilePic() {
  2.        
  3.        
  4.         //Check if the user have submit
  5.        
  6.         if($this->input->post('editPic'))
  7.         {
  8.             //Set the config for the image upload helper
  9.             $config['upload_path']      = 'archive/img/usersImg';
  10.             $config['allowed_types']    = 'gif|jpg|jpeg|png';
  11.             $config['max_size']         = 2323233;
  12.             $config['encrypt_name']     = TRUE;
  13.            
  14.             //Load the library and set the config
  15.             $this->load->library('upload', $config);
  16.            
  17.             //Start the upload helper
  18.             if( ! $this->upload->do_upload())
  19.             {
  20.                 //Something is wrong
  21.                 echo $this->upload->display_errors('<p>', '</p>');
  22.                
  23.             } else {
  24.                 //All is fine
  25.                
  26.                 echo $this->upload->data();
  27.                
  28.                
  29.                 //setup the variables
  30.                 $username = $this->session->userdata('username');
  31.                 $profileName  = $this->input->post('profileName');
  32.  
  33.                 $this->load->model('users_model');
  34.                 $this->users_model->hanleProfilePic($username, $profileName);
  35.             }
  36.         }
  37.        
  38.        
  39.        
  40.         $data['main_content'] = 'users/editProfilePic_view';
  41.         $this->load->view('template', $data);
  42.        
  43.     }
Add Comment
Please, Sign In to add comment