【发布时间】:2018-01-02 18:47:03
【问题描述】:
这是我的代码,我的照片无法插入数据库。不知道问题出在哪里。
控制器:
public function add_gambar()
{
$config['upload_path'] = './assets/img/';
$config['allowed_types'] = 'jpg|png';
$config['max_size'] = '2000';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$this->load->library('upload', $config);
if ( !$this->upload->do_upload('gambar'))
{
$this->Gambarhome_model->tambah_gambar_error();
redirect('gambarhome/','refresh');
}
else
{
$this->Gambarhome_model->tambah_gambar();
redirect('gambarhome/','refresh');
}
}
型号:
function tambah_gambar(){
$date = $this->upload->data();
$data=array(
'judul'=>$this->input->post('judul'),
'desc'=>$this->input->post('desc'),
'gambar'=>$date['file_name']
);
$this->db->insert('gambarhome',$data);
}
有人帮帮我,谢谢!
【问题讨论】:
标签: php jquery mysql codeigniter codeigniter-3