【发布时间】:2021-05-16 19:02:41
【问题描述】:
我尝试了不同的方法,但它不起作用。
function download($id)
{
$this->load->helper('download');
$fileinfo = $this->profile_model->download($id);
$file = 'uploads/'.$fileinfo['file_name'];
force_download($file, NULL);
}
public function do_upload()
{
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = 100;
$config['max_width'] = 1024;
$config['max_height'] = 768;
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload('userfile'))
{
$error = array('error' => $this->upload->display_errors());
$this->load->view('upload_form', $error);
}
else
{
$data = array('upload_data' => $this->upload->data());
$this->load->view('upload_success', $data);
}
}
}
?>
profilemodel.php
public function download($id)
{
$query = $this->db->get_where('upload_cv',array('id'=>$id));
return $query->row_array();
}
遇到 PHP 错误 严重性:通知
消息:未定义的属性:Profile_controller::$profile_model
文件名:控制器/profile_controller.php
行号:137
回溯:
文件: E:\xampp\htdocs\jobportal\application\controllers\profile_controller.php 行:137 函数:_error_handler
文件:E:\xampp\htdocs\jobportal\index.php 行:315 功能: 需要一次。
遇到 PHP 错误 严重性:错误
消息:在 null 上调用成员函数 download()
文件名:控制器/profile_controller.php
行号:137
回溯:
【问题讨论】: