简体   繁体   中英

Cannot Upload Excel file in CodeIgniter

I would like to upload excel file many times in CodeIgniter, but not successfully

(The filetype you are attempting to upload is not allowed.)

Controller Coding:

                $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');

                }

Views:

<form method="post" enctype="multipart/form-data">
<input type="file" id="userfile" name="userfile"/>
<input type="submit" name="submit" id="sumit" value="Test" />
 </form>

有臭虫在该库也许将帮助

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM