我想上传2个配置文件的2个文件,但第一个文件不起作用,第二个文件对我有用。我怎样才能在这段代码中找到问题。
请帮帮我。 这是我的代码:
$this->load->library('upload');
$config['upload_path'] = './uploads/images/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '200';
$config['max_width'] = '200';
$config['max_height'] = '200';
$config['file_name'] = time();
$this->upload->initialize($config); // Important
if ($this->upload->do_upload('logo')) {
$logo = $this->upload->data();
} elseif ($this->input->post('logo')) {
$logo['file_name'] = $this->input->post('logo');
} else {
$logo['file_name'] = '';
}
//===================================================
$config['upload_path'] = './uploads/images/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '200';
$config['max_width'] = '950';
$config['max_height'] = '250';
$config['file_name'] = time();
$this->upload->initialize($config); // Important
if ($this->upload->do_upload('header')) {
$header = $this->upload->data();
} elseif($this->input->post('header')) {
$header['file_name'] = $this->input->post('header');
} else {
$header['file_name'] = '';
}