Call to undefined method PHPExcel_Writer_Excel5::setTempDir()

Feb 12, 2008 at 12:34 PM
Since moving server I am having trouble creating using Excel5.

I have placed the test sheet at the following address http://www.doctorscareerchoices.com/excel but it displays an error starting with "Fatal error: Uncaught exception 'Exception' with message 'Can't create temporary file' in D:\Inetpub\vhosts\doctorscareerchoices.com\httpdocs\Excel\PHPExcel\Shared\OLE\OLE_File.php:90 Stack trace: #0"

I have then tried using setTempDir as per View.aspx?ThreadId=17955 but it then displays "Fatal error: Call to undefined method PHPExcelWriterExcel5::setTempDir() in D:\Inetpub\vhosts\doctorscareerchoices.com\httpdocs\Excel\index.php on line 56"

Does anyone know of this problem or if I have old files etc.

Thanks
Coordinator
Feb 12, 2008 at 2:04 PM
Are you sure the directory passed to setTempDir() is writable? Looking at http://www.doctorscareerchoices.com/excel/ seems like this is not the case.
Feb 12, 2008 at 3:33 PM
Hi maartenba, the directory is writable.

I have these lines in my script...

$objWriter = new PHPExcelWriterExcel5($objPHPExcel);
$objWriter->setTempDir("D:\Inetpub\vhosts\doctorscareerchoices.com\httpdocs\excel");
$objWriter->save($filename);

...and the 'call to undefined method' error mentioned earlier appears?!?

Coordinator
Feb 12, 2008 at 4:23 PM
What version of PHPExcel are you using?
Feb 12, 2008 at 10:11 PM
Version 5.2.5
Feb 12, 2008 at 11:56 PM
I'm still not quite sure what was causing my problem on my new server but I managed to get around it by changing line 87 of OLE_FILE.php found in the Shared\OLE folder.

I replaced $this->tmpdir with 'test' and the error went away & the file was created as normal in the test folder.
Coordinator
Feb 13, 2008 at 7:52 AM
Will check this and fix if possible.
Feb 18, 2008 at 11:13 AM
the path you set for tmpDir ist not valid...

if you use double quote, you have to escape the \ character with \\ (or better use single quotes).

so:
$objWriter->setTempDir("D:\\Inetpub\\vhosts\\doctorscareerchoices.com\\httpdocs\\excel");
or
$objWriter->setTempDir('D:\Inetpub\vhosts\doctorscareerchoices.com\httpdocs\excel');

.. should work