bastiam / php-excel-reader2

Automatically exported from code.google.com/p/php-excel-reader2
0 stars 0 forks source link

Filename is not readable #7

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.Sometimes don't read the uploaded file, i get The filename
C:/**/**/**/uploads/a.xls is not readable.
2.
3.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?
version 2.22

Please provide any additional information below.
Sometimes when I upload a .xls I get that the filename is not readable,
when I run the application on localhost I have no problem. So I' ve checked
for permissions and for the path but they are ok, its driving me insane
because i get the error once and then if I refresh the page and try again,
it works properly, some other times it will not work even if I refresh the
page dozen of times. I use the following :

$tempFile =  $_FILES['ufile']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . '/dea/uploads/';
//$targetPath = 'uploads/';
//echo "$targetPath<br/>";

$targetFile =  str_replace('//','/',$targetPath) . $_FILES['ufile']['name'];
//echo "$targetFile<br/>";             

move_uploaded_file($tempFile,$targetFile);     

chmod($targetFile, 0755);

//Create new instance
$excel = new Spreadsheet_Excel_Reader();
//$excel->setOutputEncoding('CP1251');
$excel->read($targetFile);

I've read many threads around and i tried many modifications in order to
fix it but with no luck. Any help would be appreciated, thanks in advnace!

Original issue reported on code.google.com by gregko...@gmail.com on 10 May 2010 at 8:20

GoogleCodeExporter commented 8 years ago
I think I have the same problem,
at localhost, it works fine, but in external server, sometimes I get: "The 
filename */test.xls is not readble. So, soon after, I do nothing, and it works 
fine. Can be something with the server host?

Thanks in advance.

Original comment by leuhp...@gmail.com on 3 Jun 2011 at 6:27

GoogleCodeExporter commented 8 years ago
In my case, due to the fact I have full access to the server as in localhost, I 
assure you that the enviroments are the same (same version of apache and php, 
same options in php.ini, htcaccess etc). I haven't come up with something yet 
but I haven't got any error,recently. If I find something, I will post the 
solution.

Original comment by gregko...@gmail.com on 4 Jun 2011 at 1:02

GoogleCodeExporter commented 8 years ago
same thing on an external sever.

Original comment by kaverz...@gmail.com on 19 Feb 2012 at 7:46

GoogleCodeExporter commented 8 years ago
I have the same problem on localhost.
Do I need to change something in excel_reader2.php ?

Original comment by banamle...@gmail.com on 28 Feb 2012 at 8:12

GoogleCodeExporter commented 8 years ago
I found that my problem was when i used php-excel-reader as an extension in 
Yii. It doesn't work. I used example => It works well.

Original comment by banamle...@gmail.com on 28 Feb 2012 at 8:35

Attachments:

GoogleCodeExporter commented 8 years ago
i have the same problem please some one can help me 

Original comment by grati.a...@gmail.com on 21 Mar 2012 at 10:22

GoogleCodeExporter commented 8 years ago
I have the same fucking problem!!!

Original comment by jjones...@gmail.com on 2 Dec 2013 at 9:50

GoogleCodeExporter commented 8 years ago
Hi all, since PHP Excell is no longer delevoped, only if somebody will upload a 
fix I will work on it.

The PhpExcell is a much more compleat library that have many options.

Original comment by sirsh...@gmail.com on 3 Dec 2013 at 7:37

GoogleCodeExporter commented 8 years ago
I've got this error too, so I've made some research. Result's below.
The devil hides in multi-byte string functions in my case. php.ini on my 
developer's machine has next default settings: "mbstring.language" - was 
commented, "mbstring.internal_encoding" was commented too and 
"mbstring.func_overload" was set to "0". Everything works. But productive 
machine has "mbstring.language = Russian", "mbstring.internal_encoding = UTF-8" 
and "mbstring.func_overload = 6" So, I got "*.xls is not readable". 
"mbstring.func_overload" make sense - set it to 0 if you don't use multi-byte 
strings or you can play with internal encoding settings.

Original comment by Zhabba...@gmail.com on 6 Dec 2013 at 8:29

GoogleCodeExporter commented 8 years ago
And a bit later I've found solution. Thanks to 
http://stackoverflow.com/a/4598270
Replace every "substr()" call to "mb_susbtr(...., '8bit')". And now it works(in 
my case).

Original comment by Zhabba...@gmail.com on 6 Dec 2013 at 9:29

Attachments:

GoogleCodeExporter commented 8 years ago
And there's much more simple solution:
just add: mb_internal_encoding("8bit"); in the top of main file. No any changes 
required.

Original comment by Zhabba...@gmail.com on 16 Dec 2013 at 1:36

GoogleCodeExporter commented 8 years ago
Fixed according to Zhabba108 changes...

Version Updated to 2.23

Thanks for the patch....

Original comment by sirsh...@gmail.com on 16 Dec 2013 at 2:18