无法读取CodeIgniter中的Excel文件

我正在通过使用CodeIgniter3和PHPExcel库上传Excel文件的项目中遇到问题。

当我上传一个excel文件时,问题就发生了,文件被成功上传到文件夹中,但不能被读取。 此外,它给出了一个错误信息:

加载文件“xls_file”时出错:无法打开文件./assets/xls_file/进行读取。

所以数据不能保存到数据库中。

我希望系统读取xls_file文件夹内的文件,为什么系统读取xls_file文件夹? 我的朋友告诉我,CodeIgniter 3中的URI可能存在问题,但是我们不知道如何解决这个问题。 这是我的控制器:

 $fileName = time().$_FILES['file']['name']; $config['upload_path'] = './assets/xls_file/'; //save excel file in folder $config['file_name'] = $fileName; $config['allowed_types'] = 'xls|xlsx|csv'; $config['max_size'] = 10000; $this->load->library('upload'); $this->upload->initialize($config); if(! $this->upload->do_upload('file') ) $this->upload->display_errors(); $media = $this->upload->data('file'); $inputFileName = './assets/xls_file/'.$media['file_name']; try { $inputFileType = IOFactory::identify($inputFileName); $objReader = IOFactory::createReader($inputFileType); $objPHPExcel = $objReader->load($inputFileName); } catch(Exception $e) { die('Error loading file "'.pathinfo($inputFileName,PATHINFO_BASENAME).'": '.$e->getMessage()); } $sheet = $objPHPExcel->getSheet(0); $highestRow = $sheet->getHighestRow(); $highestColumn = $sheet->getHighestColumn(); for ($row = 2; $row <= $highestRow; $row++){ // Read a row of data into an array $rowData = $sheet->rangeToArray('A' . $row . ':' . $highestColumn . $row, NULL, TRUE, FALSE); //save into the column $data = array( "id_jalan"=> $rowData[0][0], "id_kriteria"=> $rowData[0][1], "nilai"=> $rowData[0][2], "tahun_anggaran"=> $rowData[0][3], "penanda"=> $rowData[0][4], ); //save into the tabel $insert = $this->db->insert("value",$data); //delete_files($media['file_path']); } redirect('page/landing');