I have upgraded the PHP version from 5.1.x to 5.4.14 in which reading of excel files using PHPExcelReader fails with the following warning. In the earlier version, it was working correctly.
The filename images_db/TempCountry.xlsx is not readable
The sample code for demonstration is as follows (It is Temp.php
).
<?php
require_once 'phpExcelReader/Excel/reader.php';
if(isset($_POST['btnSubmit']))
{
$data = new Spreadsheet_Excel_Reader();
$data->setOutputEncoding('CP1251'); // Set output Encoding.
move_uploaded_file($_FILES["xlfile"]["tmp_name"],"images_db/".$_FILES["xlfile"]["name"]);
$data->read('images_db/'.$_FILES["xlfile"]["name"]);
}
?>
<form action="Temp.php" id="dataForm" name="dataForm" method="post" enctype="multipart/form-data">
<input type="file" id="xlfile" name="xlfile">
<input type="submit" value="Submit" id="btnSubmit" name="btnSubmit">
</form>
When the given submit button is pressed, the excel file is first uploaded into the images_db/
directory which is successful at which place, the following line,
$data->read('images_db/'.$_FILES["xlfile"]["name"]);
is expected to read this file but it gives the warning as mentioned above.
In the reader.php
file, the following line,
$this->_ole =& new OLERead();
has been changed to
$this->_ole = new OLERead();
to avoid the following warning.
Deprecated: Assigning the return value of new by reference is deprecated in C:\wamp\www\wagafashion\phpExcelReader\Excel\reader.php on line 261
Why isn't an excel file (neither xls nor xlsx) read by PHPExcelReader in this new version of PHP? Does it have to do something with the version?