emprit

file_name

Dec 8th, 2012
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.94 KB | None | 0 0
  1. ---------------controller--------------
  2. function tambahbiodata() {
  3.         if($this->session->userdata('sudah_login_pelamar')){
  4.                         $user=$this->session->userdata('username');
  5.             $config['upload_path'] = './biodata_pelamar/';
  6.             $config['allowed_types'] = 'jpg|pdf';
  7.  
  8.             $this->load->library('upload', $config);
  9.  
  10.                 if ( ! $this->upload->do_upload()){
  11.                     $array = array( 'content' => $this->load->view('akun_pelamar/gagal','',true) );
  12.                $this->load->view('akun_pelamar/menu', $array);
  13.                 }else{
  14.                     $this->load->model('pelamar_model');
  15.                                         $this->pelamar_model->update($user);
  16.                     $reg['query'] = $this->pelamar_model->tambahbiodata();
  17.                         if($reg['query']) {
  18.                             $array = array( 'content' => $this->load->view('akun_pelamar/sukses','',true) );
  19.                             $this->load->view('akun_pelamar/menu', $array);
  20.                         }
  21.                 }
  22.         }else {
  23.             redirect('index/index');
  24.             }
  25.         }
  26.  
  27. ----------------Model----------------------
  28. function tambahbiodata() {
  29.         $no=$this->input->post('no_urut');     
  30.        
  31.         $img = $this->upload->data();
  32.         $file_name = "GE".$no."_".$img['file_name'];
  33.  
  34.         $data = array(
  35.                     'no_urut'=>$no,
  36.                     'noktp'=>$this->input->post('noktp'),
  37.                     'nama_lengkap'=>$this->input->post('nama'),
  38.                     'tempat_lahir'=>$this->input->post('tempat_lahir'),
  39.                     'tgl_lahir'=>$this->input->post('tgl_lahir'),
  40.                     'jk'=>$this->input->post('jk'),
  41.                     'alamat'=>$this->input->post('alamat'),
  42.                     'kota'=>$this->input->post('kota'),
  43.                     'country'=>$this->input->post('country'),
  44.                     'kodepos'=>$this->input->post('kodepos'),
  45.                     'agama'=>$this->input->post('agama'),
  46.                     'goldar'=>$this->input->post('goldar'),
  47.                     'telp'=>$this->input->post('telp'),
  48.                     'status'=>$this->input->post('status'),
  49.                     'email'=>$this->input->post('email'),
  50.                     'file'=>'biodata_pelamar/'.$file_name
  51.                     );
  52.         $query = $this->db->insert('biodata_pelamar',$data);
  53.         return $query;
  54.     }
Advertisement
Add Comment
Please, Sign In to add comment