codeigniter phpexcel error ZipArchive::getFromName(): Invalid or uninitialized Zip object

i'm trying to import data to oracle from excel file (.xlsx) use codeigniter and phpexcel, this is my controller :

private $filename;
public function form(){
    $data = array(); 
    if(isset($_POST['preview'])){ 
        $upload = $this->RoadmapModel->upload_file($this->filename);
        $upload_data = $this->upload->data();
        $this->filename = $upload_data['file_name'];
        
        if($upload['result'] == "success"){ 
            include APPPATH.'third_party/PHPExcel/PHPExcel.php';
            $excelreader = new PHPExcel_Reader_Excel2007();
            $loadexcel = $excelreader->load('excel/'.$this->filename); 
            $sheet = $loadexcel->getActiveSheet()->toArray(null, true, true ,true);
            $data['sheet'] = $sheet; 
           }else{ // Jika proses upload gagal
            $data['upload_error'] = $upload['error'];
        }
    }       
    $this->load->view('form', $data);
}

public function import(){
    include APPPATH.'third_party/PHPExcel/PHPExcel.php';        
    $excelreader = new PHPExcel_Reader_Excel2007();
    $loadexcel = $excelreader->load('excel/'.$this->filename = $this -> form()); 
    $sheet = $loadexcel->getActiveSheet()->toArray(null, true, true ,true);
    $data = [];
    $numrow = 1;
    foreach($sheet as $row){
        if($numrow > 1){
            // Kita push (add) array data ke variabel data
            array_push($data, [
                'TAHUN'=>$row['A'], 
                'PROVINCEID'=>$row['B'], 
                'PROVINSI'=>$row['C'], 
                'PLAN_DESAB'=>$row['D'], 
                'ACTUAL_DESAB'=>$row['E'],
                'PLAN_ELEKTRIFIKASI'=>$row['F'],
                'ACTUAL_ELEKTRIFIKASI'=>$row['G'],
                'PLAN_LISDES'=>$row['H'],
                'ACTUAL_LISDES'=>$row['I'],
            ]);
        }           
        $numrow++;
    }
    $this->RoadmapModel->insert_multiple($data);
    redirect("Roadmap"); 
}

and this is my model :

public $tablename = "X";
function upload_file($filename){
    $this->load->library('upload'); 
    
    $config['upload_path'] = './excel/';
    $config['allowed_types'] = 'xlsx';
    $config['max_size'] = '2048';
    $config['overwrite'] = true;
    $config['file_name'] = $filename;

    $this->upload->initialize($config); 
    if($this->upload->do_upload('file')){ 
        $return = array('result' => 'success', 'file' => $upload_data = $this->upload->data(), 'error' => '');
        return $return;
    }else{
        $return = array('result' => 'failed', 'file' => '', 'error' => $this->upload->display_errors());
        return $return;
    }
}

function insert_multiple($data){
    $p_tablename= $this->tablename;
    $this->db->insert_batch($p_tablename, $data);
}

and when i use import function, this is error message :

Message: ZipArchive::getFromName(): Invalid or uninitialized Zip object

Filename: Reader/Excel2007.php

Line Number: 327

Backtrace :

File: C:\xampp\htdocs\web_excel_ci\application\controllers\Roadmap.php

Line: 82

Function: load

line : 82 is $loadexcel = $excelreader->load('excel/'.$this->filename = $this -> form()); in function import()

that is for load which excel file would be to import, i try to get filename from function form() with $this->filename = $this->form(), but that is make an error

please help for solution couse i've stack there

Thanks a lot...


From the Docs

By default, PHPWord uses Zip extension to deal with ZIP compressed archives and files inside them. If you can’t have Zip extension installed on your server, you can use pure PHP library alternative, PclZip, which is included in PHPWord.

\PhpOffice\PhpWord\Settings::setZipClass(\PhpOffice\PhpWord\Settings::PCLZIP);

This worked for me.