title: codeigniter phpexcel error ZipArchive::getFromName(): Invalid or uninitialized Zip object
body: <p>i'm trying to import data to oracle from excel file (.xlsx) use codeigniter and phpexcel, this is my controller :</p>
  <pre><code>private $filename;
  public function form(){
      $data = array(); 
      if(isset($_POST['preview'])){ 
          $upload = $this-&gt;RoadmapModel-&gt;upload_file($this-&gt;filename);
          $upload_data = $this-&gt;upload-&gt;data();
          $this-&gt;filename = $upload_data['file_name'];
          
          if($upload['result'] == &quot;success&quot;){ 
              include APPPATH.'third_party/PHPExcel/PHPExcel.php';
              $excelreader = new PHPExcel_Reader_Excel2007();
              $loadexcel = $excelreader-&gt;load('excel/'.$this-&gt;filename); 
              $sheet = $loadexcel-&gt;getActiveSheet()-&gt;toArray(null, true, true ,true);
              $data['sheet'] = $sheet; 
             }else{ // Jika proses upload gagal
              $data['upload_error'] = $upload['error'];
          }
      }       
      $this-&gt;load-&gt;view('form', $data);
  }
  
  public function import(){
      include APPPATH.'third_party/PHPExcel/PHPExcel.php';        
      $excelreader = new PHPExcel_Reader_Excel2007();
      $loadexcel = $excelreader-&gt;load('excel/'.$this-&gt;filename = $this -&gt; form()); 
      $sheet = $loadexcel-&gt;getActiveSheet()-&gt;toArray(null, true, true ,true);
      $data = [];
      $numrow = 1;
      foreach($sheet as $row){
          if($numrow &gt; 1){
              // Kita push (add) array data ke variabel data
              array_push($data, [
                  'TAHUN'=&gt;$row['A'], 
                  'PROVINCEID'=&gt;$row['B'], 
                  'PROVINSI'=&gt;$row['C'], 
                  'PLAN_DESAB'=&gt;$row['D'], 
                  'ACTUAL_DESAB'=&gt;$row['E'],
                  'PLAN_ELEKTRIFIKASI'=&gt;$row['F'],
                  'ACTUAL_ELEKTRIFIKASI'=&gt;$row['G'],
                  'PLAN_LISDES'=&gt;$row['H'],
                  'ACTUAL_LISDES'=&gt;$row['I'],
              ]);
          }           
          $numrow++;
      }
      $this-&gt;RoadmapModel-&gt;insert_multiple($data);
      redirect(&quot;Roadmap&quot;); 
  }
  </code></pre>
  <p>and this is my model :</p>
  <pre><code>public $tablename = &quot;X&quot;;
  function upload_file($filename){
      $this-&gt;load-&gt;library('upload'); 
      
      $config['upload_path'] = './excel/';
      $config['allowed_types'] = 'xlsx';
      $config['max_size'] = '2048';
      $config['overwrite'] = true;
      $config['file_name'] = $filename;
  
      $this-&gt;upload-&gt;initialize($config); 
      if($this-&gt;upload-&gt;do_upload('file')){ 
          $return = array('result' =&gt; 'success', 'file' =&gt; $upload_data = $this-&gt;upload-&gt;data(), 'error' =&gt; '');
          return $return;
      }else{
          $return = array('result' =&gt; 'failed', 'file' =&gt; '', 'error' =&gt; $this-&gt;upload-&gt;display_errors());
          return $return;
      }
  }
  
  function insert_multiple($data){
      $p_tablename= $this-&gt;tablename;
      $this-&gt;db-&gt;insert_batch($p_tablename, $data);
  }
  </code></pre>
  <p>and when i use import function, this is error message :</p>
  <blockquote>
  <p>Message: ZipArchive::getFromName(): Invalid or uninitialized Zip object</p>
  <p>Filename: Reader/Excel2007.php</p>
  <p>Line Number: 327</p>
  <p>Backtrace :</p>
  <p>File: C:\xampp\htdocs\web_excel_ci\application\controllers\Roadmap.php</p>
  <p>Line: 82</p>
  <p>Function: load</p>
  </blockquote>
  <p>line : 82 is <code>$loadexcel = $excelreader-&gt;load('excel/'.$this-&gt;filename = $this -&gt; form());</code> in function import()</p>
  <p>that is for load which excel file would be to import, i try to get filename from function form() with <code>$this-&gt;filename = $this-&gt;form()</code>, but that is make an error</p>
  <p>please help for solution couse i've stack there</p>
  <p>Thanks a lot...</p>