-1
我需要使用codeigniter將圖像作爲Blob類型存儲在數據庫中。我不想將圖片上傳到文件夾中。我只是想將圖像作爲blob存儲在數據庫中。以blob類型在數據庫中插入圖像 - Codeigniter
我有這個在我的模型
public function insert_user()
{
$get_image = $this->input->post(file_get_contents($_FILES['imgProfile']['tmp_name'])); //imgProfile is the name of the image tag
$insert_values = array(
'first_name' => $this->input->post('FirstName'),
'last_name' => $this->input->post('LastName'),
'profile_image' => $this->$get_image
);
$insert_qry = $this->db->insert('user', $insert_values);
}
我控制器包含
public function new_user()
{
$this->user_model->insert_user(); //user_model is the model name
}
錯誤:
Fatal error: Cannot access empty property in C:\xampp\htdocs\CI\system\core\Model.php on line 52
感謝。
什麼是Model.php中的L52? – Florian
參考$ this - > $ getimage是錯誤的,它應該是$ this-> getimage或者簡單的$ getimage(在本地函數中使用) –