使用codeigniter到mysql的上传数据excel中无法读取文件名C:\ xampp \ tmp \ php4632.tmp

时间:2014-08-26 02:16:54

标签: php mysql excel codeigniter

在它之前,我使用其他函数将excel数据与codeigniter上传到mysql,但显示错误文件路径不可读,然后我使用此代码上传excel数据

//setting excel reader   
error_reporting(E_ALL ^ E_NOTICE);
error_reporting(0);
require_once 'include/excel_reader.php';
    $get_periode    = $this->input->post("periode");
    $data = new Spreadsheet_Excel_Reader($_FILES['userfile']['tmp_name']);
    $count = 0;
    //read excel
    foreach($data->dump(false,false,false,false) as $row){
    $value  = $this->ruas_jalan_model->get_by(array("NAMA_KOTA"=>$row["NAMA_KOTA"]),FALSE,FALSE,TRUE);
                    $data2  = array(
                        "ID_PERIODE"        => $get_periode,
                        "NAMA_KOTA"         => $value["NAMA_KOTA"],
                        "NO_RUAS1"          => $value["NO_RUAS1"],
                        "NO_RUAS2"          => $value["NO_RUAS2"],
                        "NO_RUAS3"          => $value["NO_RUAS3"],
                        "NAMA_RUAS"         => $value["NAMA_RUAS"],
                        "PANJANG"           => $value["PANJANG"],
                        "HOTMIX_BAIK"       => $value["HOTMIX_BAIK"],
                        "HOTMIX_SEDANG"     => $value["HOTMIX_SEDANG"],
                        "HOTMIX_RR"         => $value["HOTMIX_RR"],
                        "HOTMIX_RB"         => $value["HOTMIX_RB"],
                        "LAPEN_BAIK"        => $value["LAPEN_BAIK"],
                        "LAPEN_SEDANG"      => $value["LAPEN_SEDANG"],
                        "LAPEN_RR"          => $value["LAPEN_RR"],
                        "LAPEN_RB"          => $value["LAPEN_RB"],
                        "LPC"               => $value["LPC"],
                        "TANAH"             => $value["TANAH"],
                        "HUTAN"             => $value["HUTAN"],
                        "LANG"              => $value["LATITUDE"],
                        "LOT"               => $value["LOTITUDE"]
                    );
                    $this->ruas_jalan_model->save($data2);
                    $count++;                                               
            }

但我仍然得到错误不可读,我不知道为什么,这是错误代码

The filename C:\xampp\tmp\php4632.tmp is not readable

怎么了?

1 个答案:

答案 0 :(得分:0)

问题是图书馆无法通过扩展名xlsx(ms.office 2007 - >)读取Excel,然后我使用xls(ms.office 2003)