I can upload files. xlsx but no. xls

Topics: Developer Forum
Jan 18, 2012 at 1:32 PM

when I load a file. xlsx, goes well. But when I try with a file. Xls, get error in the line: $objPHPExcel = $ objReader-> load ($ filename).



if ($tipo_archivo=="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") {


$objReader = new PHPExcel_Reader_Excel2007();                   

} else {           


$objReader = new PHPExcel_Reader_Excel5();       


$objPHPExcel = $objReader->load($nombre_archivo);       



while($objPHPExcel->getActiveSheet()->getCell("B".$i)->getValue() != '')        {             

  $sexo = $objPHPExcel->getActiveSheet()->getCell("F".$i)->getValue();           

$tipodoc = $objPHPExcel->getActiveSheet()->getCell("G".$i)->getValue();           

$numdoc = $objPHPExcel->getActiveSheet()->getCell("H".$i)->getValue();            

$carga = mysql_query("insert into temphv (sexo,tipodoc,numdoc)  values('$sexo','$tipodoc','$numdoc')",$db);                       



Jan 18, 2012 at 4:58 PM

Telling us what error you get might help

Jan 18, 2012 at 6:14 PM

This is the error:

Fatal error: Call to a member function getNestingLevel() on a non-object in C:\wamp\www\iecasd\Classes\PHPExcel\Reader\Excel5.php on line 842

Jan 18, 2012 at 6:57 PM

There's something in the specific file that you're testing with that PHPExcel expects, but isn't finding.... quite what I couldn't say without seeing the file itself.