Good, I need to create a form where users can upload an xlsx file, and the web app validate the file then read it, and finally I need to put the information after evaluating it in a database, I'm using a PHPExcel library , the problem is that it gives me an error on the page, When I place the xlsx file that will read, it marks me error on the web, (This page does not work) HTTP ERROR 500. Debugeando, it is not a route error since I was placing routes one by one, and put the name of the file wrong to test and gave me the catch, error that the file does not exist, but when I place the route correctly, PAM gives me error.
require_once('../phpexcel/Classes/PHPExcel.php');
require_once('../phpexcel/Classes/PHPExcel/Reader/Excel2007.php');
require_once '../phpexcel/Classes/PHPExcel/IOFactory.php';
$inputFileName = '../phpexcel/Classes/PHPExcel/jd.xlsx';
try {
$objReader = PHPExcel_IOFactory::createReader('Excel2007');
$objReader->setReadDataOnly(true);
$objPHPExcel = $objReader->load($inputFileName);
$objWorksheet = $objPHPExcel->getActiveSheet();
echo '<table>' . "\n";
foreach ($objWorksheet->getRowIterator() as $row) {
echo '<tr>' . "\n";
$cellIterator = $row->getCellIterator();
$cellIterator->setIterateOnlyExistingCells(false); // This loops all cells,
foreach ($cellIterator as $cell) {
echo '<td>' . $cell->getValue() . '</td>' . "\n";
}
echo '</tr>' . "\n";
}
echo '</table>' . "\n";
} catch(Exception $e) {
die('Error loading file "'.pathinfo($inputFileName,PATHINFO_BASENAME).'": '.$e->getMessage());
}
echo '<hr />';
echo "<pre>";
Result : Failed to load resource: the server responded with a status of 500 (Internal Server Error)