在codeigniter Error Occure中上传excel文件

时间:2016-08-23 07:17:33

标签: php codeigniter phpexcel codeigniter-3

我使用Codeigniter上传excel文件此代码正常工作但我的localhost然后在实时服务器上传然后没有上传

这是我的代码

function excelimport(){

$this->load->library('excel');           
        $file = $_FILES['userfileexcel']['tmp_name'];
        echo $file; 
              //read file from path
              $objPHPExcel = PHPExcel_IOFactory::load($file);

              //get only the Cell Collection
              $cell_collection = $objPHPExcel->getActiveSheet()->getCellCollection();
              //extract to a PHP readable array format
              foreach ($cell_collection as $cell) {
                  $column = $objPHPExcel->getActiveSheet()->getCell($cell)->getColumn();
                  $row = $objPHPExcel->getActiveSheet()->getCell($cell)->getRow();
                  $data_value = $objPHPExcel->getActiveSheet()->getCell($cell)->getValue();
                  //header will/should be in row 1 only. of course this can be modified to suit your need.
                  if ($row == 1) {
                      $header[$row][$column] = $data_value;
                  } else {
                      $arr_data[$row][$column] = $data_value;
                  }

                   // print_r($column);
              }
              //send the data in an array format
              $data['header'] = $header;
               $data['values'] = $arr_data;

            $count=2;
             for($i=1;$i<$row;$i++){
              $exceldata = array(
                'title' => $data['values'][$count]['A'],
                'quantity' =>  $data['values'][$count]['B'],
                'price' =>  $data['values'][$count]['C']);             
                  print_r($exceldata);  
              //$this->upload_services->insert_excel($exceldata);
              $count++;   
            } 

}

错误

的/ tmp / phpYIZkd4

0 个答案:

没有答案