【发布时间】:2016-07-26 05:56:13
【问题描述】:
我正在尝试上传一个 zip 文件,但我遇到了一些错误,我想显示其中的图像。这是我的代码这是我的代码:
控制器
$config['upload_path'] = './img/header/';
$config['allowed_types'] = 'rar|zip|gif|jpg|png|jpeg';
$config['max_size'] = '2048000';
$config['overwrite'] = TRUE;
$this->load->library('upload', $config);
$this->load->library('form_validation');
$this->form_validation->set_error_delimiters('<div class="alert alert-danger" role="alert">', '</div>');
$this->form_validation->set_rules('title', 'Name', 'trim|required');
if ($this->form_validation->run() == FALSE || !$this->upload->do_upload('userfile')) {
$this->load->view('plmar/admin/headContent');
} else {
$content = array(
'header_title' => $_POST['title'],
'header_path' => $_POST['userfile'],
'upload_data' => $this->upload->data()
);
$this->adminModel->addContent($content);
redirect('Administrator/headContent');
}
$this->load->view('admin/footer');
【问题讨论】:
-
将代码粘贴为文本而非图像。
标签: php codeigniter model-view-controller file-upload zip