I'm receiving this error ...Notice: Undefined offset: 126 in /var/www/clients/client1/web1/web/manage/Classes/PHPExcel/Reader/Excel5.php on line 5873 when I'm attempting to import a .xls file. Yet it works fine with an xlsx file. If I wave the working .xlsx file as an .xls file it fails?
$fPath = "uploads/";
include('./Classes/PHPExcel.php');
include('./Classes/PHPExcel/IOFactory.php');
// Add file name to file path
$fPath = $fPath . basename($_FILES['fileUpload']['name']);
$ext = pathinfo($fPath, PATHINFO_EXTENSION);
if (move_uploaded_file($_FILES['fileUpload']['tmp_name'], $fPath)) {
$output = "";
if ($ext == "xlsx") {
$fileType = 'Excel2007';
} else {
$fileType = 'Excel5';
}
//echo " fileType=$fileType";
$sheetname = 'IRBIMport';
// Read the file
$objReader = PHPExcel_IOFactory::createReader($fileType);
$objReader->setReadDataOnly(true);
$objReader->setLoadSheetsOnly($sheetname);
$objPHPExcel = $objReader->load($fPath);
$excelOut = $objPHPExcel->getActiveSheet();
} else {
$output = "failed to upload";
}
if I comment out this line $objPHPExcel = $objReader->load($fPath); I don't get the error but I'm still haven't got a clue how to resolve?
Any help would be appreciated.