Yii Framework Forum: Yii Php-Excel-Reader - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Yii Php-Excel-Reader Resolve the path to the .xls or any file Rate Topic: -----

#1 User is offline   debarya 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 05-March 13

Posted 05 March 2013 - 01:36 AM

If you use the extension http://www.yiiframew...p-excel-reader/, you might get an error while using it if you do not specify the absolute path to the xls file. The code to read .xls file is the following

$data=new JPhpExcelReader('example.xls');

It should be changed to

$data=new JPhpExcelReader(Yii::app()->getBasePath().'/import/example.xls');

Yii::app()->getBasePath() return /var/www/projectname/protected. "import" is the folder name where the .xls is kept
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users