application/controllers/Book.php
// method untuk edit data buku berdasarkan id
method untuk edit data buku berdasarkan id
method untuk edit data buku berdasarkan id
public function edit()
	{
		$temp = explode(".", $_FILES["imgcover"]["name"]);
		$name = date('YmdHis') . '.' . end($temp);
		$config['upload_path'] = './assets/images/';
		$config['allowed_types'] = 'gif|jpg|png';
		$config['file_name'] = $name;
		$this->upload->initialize($config);
		if (!$this->upload->do_upload('imgcover')) {
			$filename = "";
		} else {
			$filename = $name;
		}
		$judul = $_POST['judul'];
		$pengarang = $_POST['pengarang'];
		$penerbit = $_POST['penerbit'];
		$sinopsis = $_POST['sinopsis'];
		$thnterbit = $_POST['thnterbit'];
		$idkategori = $_POST['idkategori'];
		$idbuku = $_POST['idbuku'];
		$this->book_model->editBook($judul, $pengarang, $penerbit, $thnterbit, $sinopsis, $idkategori, $filename, $idbuku);
		redirect('dashboard/books');
	}
public function edit ( ) { $ temp = explode ( " . " , $ _FILES [ " imgcover " ] [ " name " ] ) ; $ name = date ( 'YmdHis' ) . '.' . end ( $ temp ) ; $ config [ 'upload_path' ] = './assets/images/' ; $ config [ 'allowed_types' ] = 'gif|jpg|png' ; $ config [ 'file_name' ] = $ name ; $ this -> upload -> initialize ( $ config ) ; if ( ! $ this -> upload -> do_upload ( 'imgcover' ) ) { $ filename = " " ; } else { $ filename = $ name ; } $ judul = $ _POST [ 'judul' ] ; $ pengarang = $ _POST [ 'pengarang' ] ; $ penerbit = $ _POST [ 'penerbit' ] ; $ sinopsis = $ _POST [ 'sinopsis' ] ; $ thnterbit = $ _POST [ 'thnterbit' ] ; $ idkategori = $ _POST [ 'idkategori' ] ; $ idbuku = $ _POST [ 'idbuku' ] ; $ this -> book_model -> editBook ( $ judul , $ pengarang , $ penerbit , $ thnterbit , $ sinopsis , $ idkategori , $ filename , $ idbuku ) ; redirect ( 'dashboard/books' ) ; }
method untuk edit data buku berdasarkan id
method untuk edit data buku berdasarkan id
// $this->upload->do_upload("imgcover"); // baca nama file upload // $filename = $_FILES["imgcover"]["name"]; // baca data dari form insert buku