[eluser]anyamanggar[/eluser]
hi guys, i have a lilte problem in update image file. The Case is when i want to update image i have finish upload but evertything id what i post is same with other, please help me..
Code:
function editgambarberita() {
if ($_FILES) {
$config = array(
'upload_path' => 'images/uploads/berita/',
'allowed_types' => 'gif|jpeg|jpg|png',
'max_size' => '5120' // 5MB
);
$this->load->library('upload', $config);
$this->upload->initialize($config);
if ($this->upload->do_upload()) {
$data = array(
'upload_data' => $this->upload->data()
);
$file_name = $data['upload_data']['file_name'];
$save['img_path'] = $file_name;}
$this->load->model('news_model');
$this->news_model->updategbr($save['file_name']);
}
if($_POST != NULL) {
redirect('news_admin');
}
$this->load->view('admin/gantigambarberita_view');
}
my model
Code:
function updategbr($data) {
$this->db->update('news',$data);
}