无法在CodeIgniter中上载Excel文件

时间:2012-11-08 08:40:09

标签: php codeigniter

我想在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>

1 个答案:

答案 0 :(得分:1)

该库可能有this帮助