我尝试使用 PHP 将大图像 (>~1.5MB) 上传到我的网站,但文件没有出现在服务器上。有时我会收到错误 1(超出最大尺寸)。
有什么我可以做的吗?
public function do_upload($field) {
$config['upload_path'] = './uploads/';
$config['max_size'] = '100000';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$this->load->library('upload', $config);
if (!$this->upload->do_upload($field)) {
$error = array('error' => $this->upload->display_errors());
return $error;
} else {
/*$data = array('upload_data' => $this->upload->data());
return $data;*/
$updata =$this->upload->data();
$data = $updata['raw_name'].$updata['file_ext'];
return $data;
}
}
我可以在这里调用函数:
$pic = $this->do_upload('inputUpProfile');
这里我将图片保存到数据库中:
if ($this->input->post('post') == ''){
$type="image";
} else {
$type="image-with-text";
}
} else {
$pic = "";
$type = "text";
}
$result = $this->blog->addPost($_SESSION['user_id'], $type , $this->input->post('post'),$pic);
}
楷模:
function addPost($user_id, $post_type, $post , $pic ) {
$today = date("Y-m-d H:i:s");
$vales = array('ev_user_id' => $user_id, 'ev_type' => $post_type, 'ev_text' => $post,'ev_pic' => $pic, 'ev_date' => $today);
$this->db->insert($this->table_name, $vales);
}
错误:
错误号:1054
“字段列表”中的未知列“数组”
插入
events
(ev_user_id
,ev_type
,ev_text
,ev_pic
,ev_date
) 值 (1, 'image', '', Array, '2013-10-02 23:32:50')