我想在CodeIgniter中多次上传excel文件,但没有成功
(不允许您尝试上传的文件类型。)
控制器编码:
$this->load->library('upload');
$this->load->helper('file');
//$config['upload_path'] = XLS_PATH;
$config['upload_path'] = './public/test/files/test/';
$config['allowed_types'] = 'xls|xlsx';
$config['max_size'] = 0;
$this->upload->initialize($config);
echo $this->upload->file_type;
if (!$this->upload->do_upload('userfile'))
{
echo $this->upload->display_errors();
}
else
{
$this->upload->do_upload('userfile');
}
查看:
<form method="post" enctype="multipart/form-data">
<input type="file" id="userfile" name="userfile"/>
<input type="submit" name="submit" id="sumit" value="Test" />
</form>