saat upload file .xlsx eror respon File does not exist.

saya ada kendala, saat upload file format .xlsx responnya : 
Error loading file "112435.xlsx": Could not open uploads/dokumen/impor/112435.xlsx for reading! File does not exist.

yang salah atau kekurangannya dimana ya?

sedangkan file masih ada, tidak dipindah dan dihapus.
berikut syntaxnya

public function impor_desainer($id_elemen) {
    cek_login();
    $this->load->view('konek');
    $db = new mysqli(db_host, db_user, db_pass, db_name);
    $nama = date('His');

    mysqli_query($db, "DELETE FROM database_elemen WHERE id_dda='$id_elemen'");

    $this->load->library(array('PHPExcel', 'PHPExcel/IOFactory'));

    $fileName = time().$_FILES['dokumen']['name'];
       
    $config['upload_path'] = 'uploads/dokumen/impor/';
    $config['file_name'] = $nama.'.xlsx';
    $config['allowed_types'] = 'xlsx';
     
    $this->load->library('upload');
    $this->upload->initialize($config);
     
    if(! $this->upload->do_upload('dokumen') )
    $this->upload->display_errors();
         
    $media = $this->upload->data('dokumen');
    $inputFileName = 'uploads/dokumen/impor/'.$nama.'.xlsx';

    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++) {
      $rowData = $sheet->rangeToArray('A' . $row . ':' . $highestColumn . $row, NULL, TRUE, FALSE);
      $data = array(
        "kode1"=> $rowData[0][0],
        "kode2"=> $rowData[0][1],
        "kode3"=> $rowData[0][2],
        "kode4"=> $rowData[0][3],
        "kode5"=> $rowData[0][4],
        "kode6"=> $rowData[0][5],
        "kode7"=> $rowData[0][6],
        "urutan"=> $rowData[0][7],
        "teks"=> $rowData[0][8],
        "satuan"=> $rowData[0][9],
        "tampil"=> $rowData[0][10],
        "tampil_dataku"=> $rowData[0][11]
      );

      $impor_id_dda = $id_elemen;
      $impor_kode1 = $data['kode1'];
      $impor_kode2 = $data['kode2'];
      $impor_kode3 = $data['kode3'];
      $impor_kode4 = $data['kode4'];
      $impor_kode5 = $data['kode5'];
      $impor_kode6 = $data['kode6'];
      $impor_kode7 = $data['kode7'];
      $impor_urutan = $data['urutan'];
      $impor_teks = $data['teks'];
      $impor_satuan = $data['satuan'];
      $impor_tampil = $data['tampil'];
      $impor_tampil_dataku = $data['tampil_dataku'];
      $impor_create_at = date('Y-m-d H:i:s');
      $impor_update_at = '0000-00-00 00:00:00';

      mysqli_query($db, "INSERT INTO database_elemen SET id='', id_dda='$impor_id_dda', kode1='$impor_kode1', kode2='$impor_kode2', kode3='$impor_kode3', kode4='$impor_kode4', kode5='$impor_kode5', kode6='$impor_kode6', kode7='$impor_kode7', urutan='$impor_urutan', teks='$impor_teks', satuan='$impor_satuan', tampil='$impor_tampil', tampil_dataku='$impor_tampil_dataku', create_at='$impor_create_at', update_at='$impor_update_at'");
    }

    redirect(site_url('dda_dua/row_desainer/'.$id_elemen));
  }

avatar aziima27

@aziima27

9 Kontribusi 8 Poin


Jawaban Terpilih

library ga support, jadi diganti. referensi https://github.com/PHPOffice/PhpSpreadsheet
avatar aziima27

@aziima27

9 Kontribusi 8 Poin

Jawaban

coba format mode nya harus bisa diread
cek tentang mengubah chmod
avatar hilmanski

@hilmanski

2301 Kontribusi 1927 Poin

  • pakainya windows 10 mas. ngubah format modenya di codingnya maksudnya? apa gimana? - @aziima27
  • https://v2cloud.com/tutorials/how-to-change-folder-permissions-on-windows-2016 - @hilmanski


library ga support, jadi diganti. referensi https://github.com/PHPOffice/PhpSpreadsheet
avatar aziima27

@aziima27

9 Kontribusi 8 Poin


Login untuk gabung berdiskusi