Welcome Guest, Not a member yet? Register   Sign In
Solved: insert pic
#4

When I am trying to get the filename value from the model it is null.


A Database Error Occurred

Error Number: 1048

Column 'pic_name' cannot be null

INSERT INTO `photos` (`pic_name`) VALUES (NULL)

Filename: C:/xampp/htdocs/ci_upload_image/system/database/DB_driver.php

Line Number: 691

mphoto.php

public function insert_pic()
{

$this->pic_name = $this->upload->data('filename');

$this->db->insert('photos', $this);
}

cupload_image.php

public function do_upload()
{
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = 100;
$config['max_width'] = 500;
$config['max_height'] = 400;

$this->upload->initialize($config);


if ( ! $this->upload->do_upload('userfile'))
{
$error = array('error' => $this->upload->display_errors());

$this->load->view('upload', $error);
}
else
{
$data = array('upload_data' => $this->upload->data());

$this->mphoto->insert_pic();

$this->load->view('upload_success', $data);
}
}
" If I looks more intelligence please increase my reputation."
Reply


Messages In This Thread
Solved: insert pic - by davy_yg - 04-27-2018, 12:00 AM
RE: insert pic - by InsiteFX - 04-27-2018, 04:36 AM
RE: insert pic - by davy_yg - 04-28-2018, 06:14 AM
RE: insert pic - by davy_yg - 04-28-2018, 06:44 AM
RE: insert pic - by davy_yg - 04-28-2018, 06:59 AM



Theme © iAndrew 2016 - Forum software by © MyBB