0
嗨,我第一次來到這裏。我真的不知道我的代碼有什麼問題。 IAM試圖上傳文件到數據庫然而,當我點擊上傳按鈕,就會出現錯誤的。(沒有找到對象),希望有人能幫助我...上傳文件到數據庫
順便說一句,我的繼承人的代碼段
function do_upload()
{
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png|doc|txt|pdf';
$config['max_size'] = '5000';
$config['max_width'] = '2500';
$config['max_height'] = '2500';
$config['remove_spaces']= 'true';
$this->load->library('upload', $config);
$data= array('userfile' => $this->upload->do_upload());
//DEFINE POSTED FILE INTO VARIABLE
$name= $data['userfile']['name'];
$tmpname= $data['userfile']['tmpname'];
$type= $data['userfile']['type'];
$size= $data['userfile']['size'];
//OPEN FILE AND EXTRACT DATA /CONTENT FROM IT
$fp = fopen($tmpname, 'r');
$content= fread($fp, $size($tmpname));
$content= addslashes($content);
fclose($fp);
if (! $this->upload->do_upload())
{
$error = array('error' => $this->upload->display_errors());
$this->load->view('upload', $error);
}
else
{
$data = array('userfile' => $this->upload->data());
$this->load->database();
$ret=$this->db->insert($name, $type, $size, $content);
unlink($tmpname);
//$this->load->database();
//$this->load->view('upload', $data);
}
}
有什麼確切的錯誤? – Ross 2011-02-04 09:46:43
相關http://stackoverflow.com/questions/3748/storing-images-in-db-yea-or-nay – jondavidjohn 2011-02-04 23:15:44