Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function proses_edit()
- {
- //jika tidak ada poto yang di upload
- if (empty($_FILES['foto']['name']))
- {
- $data=array('ket'=>$this->input->post('judul'));
- $condition['id_wall'] = $this->input->post('id_wall');
- $this->wallpaper_model->updateProject($data,$condition);
- redirect ('admin/wallpaper');
- }
- //ada poto yang di upload
- else
- {
- $this->form_validation->set_rules('judul', 'Judul', 'required');
- if ($this->form_validation->run() == FALSE)
- {
- $data['errors'] = validation_errors();
- $this->load->view("admin/tambah_wallpaper",$data);
- }
- else
- {
- $config['upload_path'] = './image/wallpaper';
- $config['allowed_types'] = 'gif|jpg|png';
- $config['max_size'] = '1000';
- $config['max_width'] = '1024';
- $config['max_height'] = '768';
- $this->upload->initialize($config);
- if(!$this->upload->do_upload('foto'))
- {
- $data['errors'] = $this->upload->display_errors();
- $this->load->view('admin/tambah_wallpaper',$data);
- }
- else
- {
- $upload = $this->upload->data();
- $foto = $upload['file_name'];
- $data=array('ket'=>$this->input->post('judul'), 'wall' => $foto); $condition['id_wall'] = $this->input->post('id_wall');
- //script sampean unlink("image/wallpaper" . $this->input->post('old_image'));
- $this->wallpaper_model->updateProject($data,$condition);
- redirect('admin/wallpaper');
- }
- }
- }
- }
- //model
- function updateProject($data, $condition)
- {
- $this->db->where($condition);
- $this->db->update('tabel_wall', $data);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement