Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $foto['allowed_types'] = 'jpg|png|jpeg';
- $foto['detect_mime'] = TRUE;
- $foto['overwrite'] = TRUE;
- $foto['file_name'] = str_replace(' ', '-', $this->input->post('nama',TRUE)).'_'.str_replace(' ', '-', tgl_indo(date('Y-m-d')));
- if($this->input->post('j_k') == 'L'){
- $foto['upload_path'] = './assets/upload/ikhwan';
- }else if($this->input->post('j_k') == 'P'){
- $foto['upload_path'] = './assets/upload/akhwat';
- }
- $this->load->library('upload', $foto);
- $fileExt = pathinfo($_FILES["foto"]["name"], PATHINFO_EXTENSION);
- if(! $this->upload->do_upload("foto")){
- $this->data['foto_error'] = 0;
- $this->data['foto'] = $this->upload->display_errors('','');
- } else {
- $this->data['foto_error'] = 1;
- $this->data['foto'] = $this->upload->data('file_name');
- }
- $foto_ktm['allowed_types'] = 'jpg|png|jpeg';
- $foto_ktm['overwrite'] = TRUE;
- $foto_ktm['file_name'] = str_replace(' ', '-', $this->input->post('nama',TRUE)).'_'.str_replace(' ', '-', tgl_indo(date('Y-m-d')));
- if($this->input->post('j_k') == 'L'){
- $foto_ktm['upload_path'] = './assets/upload/ikhwan/ktm';
- }else if($this->input->post('j_k') == 'P'){
- $foto_ktm['upload_path'] = './assets/upload/akhwat/ktm';
- }
- $this->upload->initialize($foto_ktm);
- if(! $this->upload->do_upload("foto_ktm")){
- $this->data['foto_ktm_error'] = 0;
- $this->data['foto_ktm'] = $this->upload->display_errors('','');
- } else {
- $this->data['foto_ktm_error'] = 1;
- $this->data['foto_ktm'] = $this->upload->data('file_name');
- }
- if (isset($_FILES['sertifikat_ldik']['name']) && !empty($_FILES['sertifikat_ldik']['name'])) {
- $sertifikat_ldik['allowed_types'] = '*';
- $sertifikat_ldik['overwrite'] = TRUE;
- $sertifikat_ldik['file_name'] = str_replace(' ', '-', $this->input->post('nama',TRUE)).'_'.str_replace(' ', '-', tgl_indo(date('Y-m-d')));
- if($this->input->post('j_k') == 'L'){
- $sertifikat_ldik['upload_path'] = './assets/upload/ikhwan/sertifikat';
- }else if($this->input->post('j_k') == 'P'){
- $sertifikat_ldik['upload_path'] = './assets/upload/akhwat/sertifikat';
- }
- $this->upload->initialize($sertifikat_ldik);
- if(! $this->upload->do_upload("sertifikat_ldik")){
- $this->data['sertifikat_error'] = 0;
- $this->data['sertifikat'] = $this->upload->display_errors('','');
- } else {
- $this->data['sertifikat_error'] = 1;
- $this->data['sertifikat'] = $this->upload->data('file_name');
- }
- }
- if ($this->form_validation->run() == FALSE || $this->input->post('noHP') === $this->input->post('noHP_Ayah') || $this->data['foto_error'] == 0 || $this->data['foto_ktm_error'] == 0 || $this->data['sertifikat_error'] == 0) {
- $data = array(
- 'foto_' => $fileExt,
- );
- if($this->data['sertifikat_error'] == 0){
- $data['sertifikat_ldik'] = $this->data['sertifikat'];
- }
- if($this->data['foto_error'] == 0){
- $data['foto'] = $this->data['foto'];
- }
- }
Add Comment
Please, Sign In to add comment