I try to read and fetch data from excel sheet using phpexcel in Codeigniter. but I get the error The filename http://working.abc.co.in/abc/zyx/demo.xlsx is not readable
Controller code
public function index()
{
$this->load->view('admin/welcome_message');
}
function import2(){
move_uploaded_file($_FILES["file_name"]["tmp_name"], "abc/xyz/". $_FILES["file_name"]["name"]);
$file_path=base_url("abc/xyz/".$_FILES["file_name"]["name"]);
@chmod($file,0777);
$this->load->library('Spreadsheet_Excel_Reader');
$this->spreadsheet_excel_reader->setOutputEncoding('CP1251');
$this->spreadsheet_excel_reader->read($file);
$sheets=$this->spreadsheet_excel_reader->sheets[0];
error_reporting(E_ALL ^ E_NOTICE);
$excelarray=array();
for ($i = 1; $i <= $data->$sheets['numRows']; $i++) {
$excelarray['name']=$sheets['cells'][$i][1];
$excelarray['phone']=$sheets['cells'][$i][2];
}
print_r($excelarray);
$this->load->view('super_admin/welcome_message');
}
Aucun commentaire:
Enregistrer un commentaire