Filename cannot be empty - Uncaught exception 'Exception' with message 'Can't create temporary file'

Topics: Developer Forum, User Forum
Apr 23, 2010 at 10:00 AM
Edited Apr 23, 2010 at 10:01 AM
Gday gents,
well I am not a pro but I can I see this class has plenty of potential.
Anyways, so far it just saves an Excel file with these errors on my desktop...
Any suggestions/ideas? Thanks a lot for any information: I would really appreciate it!



Warning: fopen() [function.fopen]: Filename cannot be empty in D:\Inetpub\webs\websitecom\app_data\Classes\PHPExcel\Writer\Excel5\Worksheet.php on line 360

Warning: fopen() [function.fopen]: Filename cannot be empty in D:\Inetpub\webs\websitecom\app_data\Classes\PHPExcel\Shared\OLE\OLE_File.php on line 96

Fatal error: Uncaught exception 'Exception' with message 'Can't create temporary file' in D:\Inetpub\webs\websitecom\app_data\Classes\PHPExcel\Shared\OLE\OLE_File.php:98 Stack trace: #0 D:\Inetpub\webs\websitecom\app_data\Classes\PHPExcel\Writer\Excel5.php(212): PHPExcel_Shared_OLE_PPS_File->init() #1 D:\Inetpub\webs\websitecom\testpic1\detailk.php(432): PHPExcel_Writer_Excel5->save('../public/outpu...') #2 {main} thrown in D:\Inetpub\webs\websitecom\app_data\Classes\PHPExcel\Shared\OLE\OLE_File.php on line 98

Apr 26, 2010 at 8:51 AM

Uhm...  It seems no one has ever met this kind of errors...  :'-(

As John Lennon used to sing... Pleeease, heeelp mee!


Thanks again, I am struck right now.



panamon23082 (@) yahoo (DOT) it


Apr 26, 2010 at 7:19 PM

First check... does the process running your script have privilege to create files in the directory where you're trying to save?

Apr 26, 2010 at 8:19 PM
Edited Apr 26, 2010 at 8:20 PM

Thank you Mark for your reply =)

Actually these error messages come from the file created by the script and automatically saved on my desktop: the sentences I wrote in my first post appear in the Excel file cells, together with the strange symbols at the beginning (" ï»¿ ")

In case you mean temporary files on my server (which .. coff, coff.... unfortunately is, er... ehm...Windows °_°' ) I think so, since I have several other scripts uploading and downloading stuff (mostly pics) in the same place. 

Thanks again for any suggestions :-)



panamon23082 (@) yahoo (DOT) it

Apr 26, 2010 at 8:51 PM
Edited Apr 26, 2010 at 9:39 PM

Why dont you redirect output to a client’s web browser ??? or you need to save it directly on your desktop?

Apr 27, 2010 at 6:03 PM
Edited Apr 27, 2010 at 6:04 PM

Why dont you redirect output to a client’s web browser ??? or you need to save it directly on your desktop?

Ups.. Doh! Can I do that? Well, actually I didn't eve think about it (told ya I'm newbie, LOL!), and  it would be great for testing purposes. But in the end I'll definitely need to save a file on desktop.

In short, I save small Excel report tables with data obtained from a MySql DB, and to tell the truth I don't even need advanced formulas: just plus, minus, %, eheh.

Even the dummy-proof-simple-way "ContentType="application/" would be enough if using it Icould keep pictures as well as data and some simple formatting ^_^

Thanks again Mark and Nydiow! Cheers,


Marco - Panamon



Apr 28, 2010 at 1:51 PM
Edited Apr 28, 2010 at 1:57 PM

Kkk its funny because i had the same problems awhile...

So yeah you can redirect!


XLS: // Redirect output to a client’s web browser (Excel5)
header('Content-Type: application/');
header('Content-Disposition: attachment;filename="relatorio_est.xls"');
header('Cache-Control: max-age=0');

$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');


PDF: // Redirect output to a client’s web browser (Excel5)
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-type: application/pdf");
header("Pragma: public");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");        
header("Content-Disposition: attachment;filename=relatorio_est.xls");
header("Content-Transfer-Encoding: binary ");

$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'PDF');

So with those 2, you can save the report wherever you want, but its not automatically, its like a file on your browser that asks you to choice the application to open the file...

If you need do this automatically, you MUST set the rights on the directory as Mark said!


Good Luck!