arsiarne

from edit

Aug 11th, 2014
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. public function edit_profil($id=0)
  2. {
  3. $this->load->view("app_user/global/header");
  4.  
  5. if ($this->input->post('nama_user')){
  6.  
  7. $query=$this->app_model->edit_profil();
  8. $this->session->set_flashdata('success', 'Data profil berhasil di edite!');
  9. header('location:'.base_url().'app_user/manage_profil');
  10.  
  11. }elseif ($this->input->post('foto_user')){
  12.  
  13. $config['upload_path'] = "./cover/"; //lokasi folder yang akan digunakan untuk menyimpan file
  14. $config['allowed_types'] = 'gif|jpg|png|JPEG'; //extension yang diperbolehkan untuk diupload
  15. $config['file_name'] = url_title($this->input->post('foto_user'));
  16.  
  17. $this->upload->initialize($config); //meng set config yang sudah di atur
  18. if( !$this->upload->do_upload('foto_user'))
  19. {
  20. $this->session->set_flashdata('msg', 'Foto user harap di isi kembali!');
  21. header('location:'.base_url().'app_user/manage_profil');
  22. }
  23. else{
  24.  
  25. $query=$this->app_model->edit_foto();
  26.  
  27. $this->session->set_flashdata('success', 'Foto user berhasil di edite!');
  28. header('location:'.base_url().'app_user/manage_profil');
  29. }
  30. }else{
  31.  
  32. $data['user'] = $this->app_model->view_profil();
  33. $this->load->view('app_user/halaman/edite_profil',$data);
  34. }
  35. $this->load->view("app_user/global/script");
  36. }
Advertisement
Add Comment
Please, Sign In to add comment