【发布时间】:2016-11-30 21:27:23
【问题描述】:
这是我的控制器。
function upload_file() {
$config['upload_path'] = './upload/';
$config['allowed_types'] = 'iso|dmg|zip|rar|doc|docx|xls|xlsx|ppt|pptx|csv|ods|odt|odp|pdf|rtf|sxc|sxi|txt|psd|exe|avi|mpeg|mp3|mp4|3gp|gif|jpg|jpeg|png';
$config['max_size'] = 3072;
$config['max_width'] = 1024;
$config['max_height'] = 768;
$this->upload->initialize($config);
$this->load->library('upload', $config);
if (!$this->upload->do_upload('userfile'))
{
$error = array('error' => $this->upload->display_errors());
$this->load->view('header');
$this->load->view('file', $error);
$this->load->view('footer');
}
else
{
$data = array('upload_data' => $this->upload->data());
$this->load->view('header');
$this->load->view('file', $data);
$this->load->view('footer');
}
}
如何制作模型?我要上传上传图片的文件名和路径。
【问题讨论】:
-
如何在html中显示上传文件夹中的图片?
标签: php codeigniter model-view-controller