Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function edit_ebook($id=0){
- $this->load->view("app_user/global/header");
- $this->load->library('encrypt');
- if ($this->input->post('judul_ebook')){
- $config['upload_path'] = "./cover/"; //lokasi folder yang akan digunakan untuk menyimpan file
- $config['allowed_types'] = 'gif|jpg|png|JPEG'; //extension yang diperbolehkan untuk diupload
- $config['file_name'] = url_title($this->input->post('cover_ebook'));
- $this->upload->initialize($config); //meng set config yang sudah di atur
- if( !$this->upload->do_upload('cover_ebook'))
- {
- $data= array (
- 'ebook' => $this->app_model->get_ebook($id),
- 'kategori' => $this->app_model_admin->view_kategori(),
- );
- $this->load->view('app_user/halaman/edit_ebook',$data);
- }
- else{
- if($this->app_model->edit_ebook())
- {
- $this->session->set_flashdata('success', 'Your ebook successfully created!');
- header('location:'.base_url().'app_user/manage_ebook');
- }
- else
- {
- $this->session->set_flashdata('msg', 'Error insert database');
- header('location:'.base_url().'app_user/manage_ebook');
- }
- }
- }else{
- $data= array (
- 'ebook' => $this->app_model->get_ebook($id),
- 'kategori' => $this->app_model_admin->view_kategori(),
- );
- $this->load->view('app_user/halaman/edit_ebook',$data);
- }
- $this->load->view("app_user/global/script");
- }
Advertisement
Add Comment
Please, Sign In to add comment