I'm trying to load an excel file to be read with PHPExcel reader object:
$inputFileName = $_FILES['excelimportfile']['tmp_name'];
//Read your Excel workbook
try {
$inputFileType = PHPExcel_IOFactory::identify($inputFileName);
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
$objPHPExcel = $objReader->load($inputFileName);
}catch(Exception $e) {
$this->session->set_flashdata(
'error','Error loading file "'.
pathinfo($inputFileName,PATHINFO_BASENAME).'": '.$e->getMessage()
);
redirect('admin/zipcode');
}
But who's gonna throw the exception? this $objPHPExcel = $objReader->load($inputFileName); line should have been used to generate the exception i think. eg:
$objPHPExcel = $objReader->load($inputFileName);
if(!$objPHPExcel) throw new Exception($objPHPExcel->load_error(),1);
But I found nothing like this anywhere. What to do now???