【发布时间】:2020-06-17 04:23:59
【问题描述】:
我有一个包含 4 个文件字段的表单,我想正确上传这些文件。
我的代码如下:
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);
}
}
【问题讨论】:
-
前几天我写了一个类似问题的答案;也许这会有所帮助 - stackoverflow.com/questions/62373664/…
-
您对此有何疑问?您能否解释一下究竟在给定代码中的哪些问题,以及您尝试解决的问题?
标签: php html codeigniter