Ciao a tutti,
dato questo codice:
Codice PHP:
<?php
include_once (DIRECCION . "Classes/PHPExcel.php");
include_once (DIRECCION . "Classes/PHPExcel/Reader/Excel2007.php");
class Controlador_excelajax extends CONTROLADORPROTOTIPO {
public function PAGINA_detalles($html) {
$objReader = new PHPExcel_Reader_Excel2007();
if (!array_key_exists("excelfile", $_FILES) && !array_key_exists("tmp_name", $_FILES['excelfile']) ){
echo("el fichero no existe");
return;
}
$fichero = $_FILES['excelfile']['tmp_name'];
if (file_exists($fichero) && $_FILES['excelfile']['type'] == "application/octet-stream") {
$objPHPExcel = $objReader->load($fichero);//LINEA CHE PRODUCE L'EXCEPTION
$objPHPExcel->setActiveSheetIndex(0);
$a = $objPHPExcel->getActiveSheet()->getCellByColumnAndRow(0, 1)->getValue(); //columna,linea
echo($a);
} else {
echo("el fichero no es correcto");
}
}
}
Questo codice non fa altro che leggere un file excel e estrapolare una linea e colonna determinata (più avanti leggerà tutto il file excel, ma per il momento sto testando solo il codice scritto).
Se invio un file di tipo .url si produce un errore che vorrei controllare. Ho provato a mettere la linea che mi produce l'errore nel try catch ma il problema persiste.
La linea incriminata è la seguente:
Codice PHP:
$objPHPExcel = $objReader->load($fichero);
La exception generata, se carico un file con estensione .url:
( ! ) SCREAM: Error suppression ignored for |
( ! ) Warning: ZipArchive::getFromName(): Invalid or unitialized Zip object in C:\wamp\www\Classes\PHPExcel\Reader\Excel2007.php on line 327 |
Call Stack |
# |
Time |
Memory |
Function |
Location |
1 |
0.0004 |
257224 |
{main}( ) |
..\index.php:0 |
2 |
0.0085 |
930560 |
Distribuidor->set( ) |
..\index.php:11 |
3 |
1.0406 |
2172272 |
Distribuidor->setMetodoRender( ) |
..\Class_Distribuidor.php:40 |
4 |
1.0406 |
2172480 |
Distribuidor->llamaRender( ) |
..\Class_Distribuidor.php:80 |
5 |
1.0407 |
2172552 |
CONTROLADOR->renderAjax( ) |
..\Class_Distribuidor.php:88 |
6 |
1.0408 |
2173208 |
CONTROLADOR->llamaMetodo( ) |
..\Class_CONTROLADOR.php:331 |
7 |
1.0408 |
2173248 |
Controlador_excelajax->PAGINA_detalles( ) |
..\Class_CONTROLADOR.php:367 |
8 |
1.0432 |
2440704 |
PHPExcel_Reader_Excel2007->load( ) |
..\Controlador_excelajax.php:24 |
9 |
1.0683 |
5449224 |
PHPExcel_Reader_Excel2007->_getFromZipArchive( ) |
..\Excel2007.php:364 |
10 |
1.0689 |
5476768 |
ZipArchive->getFromName( ) |
..\Excel2007.php:327 |
( ! ) SCREAM: Error suppression ignored for |
( ! ) Warning: ZipArchive::getFromName(): Invalid or unitialized Zip object in C:\wamp\www\Classes\PHPExcel\Reader\Excel2007.php on line 330 |
Call Stack |
# |
Time |
Memory |
Function |
Location |
1 |
0.0004 |
257224 |
{main}( ) |
..\index.php:0 |
2 |
0.0085 |
930560 |
Distribuidor->set( ) |
..\index.php:11 |
3 |
1.0406 |
2172272 |
Distribuidor->setMetodoRender( ) |
..\Class_Distribuidor.php:40 |
4 |
1.0406 |
2172480 |
Distribuidor->llamaRender( ) |
..\Class_Distribuidor.php:80 |
5 |
1.0407 |
2172552 |
CONTROLADOR->renderAjax( ) |
..\Class_Distribuidor.php:88 |
6 |
1.0408 |
2173208 |
CONTROLADOR->llamaMetodo( ) |
..\Class_CONTROLADOR.php:331 |
7 |
1.0408 |
2173248 |
Controlador_excelajax->PAGINA_detalles( ) |
..\Class_CONTROLADOR.php:367 |
8 |
1.0432 |
2440704 |
PHPExcel_Reader_Excel2007->load( ) |
..\Controlador_excelajax.php:24 |
9 |
1.0683 |
5449224 |
PHPExcel_Reader_Excel2007->_getFromZipArchive( ) |
..\Excel2007.php:364 |
10 |
1.0691 |
5477416 |
ZipArchive->getFromName( ) |
..\Excel2007.php:330 |
Ce ne sono altre ma purtroppo il mio msg diventa troppo lungo e non me lo lascia pubblicare.
Grazie, Roberto