Zeka Posted July 8, 2018 Share Posted July 8, 2018 Hi. I'm trying to save an xls file to temp folder .... $writer = IOFactory::createWriter($spreadsheet, 'Xls'); $wireTempDir = wire('files')->tempDir('testname' . time()); $writer->save($wireTempDir->get() . "featuredemo.xls"); The issue is that $wireTempDir return the path to temp folder like D:/laragon/www/p/app/site/assets/cache/WireTempDir/.testname1531040249/0/ But it creates only .testname1531040249 folder without subfolder '0'. Am I missing something? Link to comment Share on other sites More sharing options...
Robin S Posted July 8, 2018 Share Posted July 8, 2018 2 hours ago, Zeka said: But it creates only .testname1531040249 folder without subfolder '0'. The subfolder will be created, and you most likely are saving your file to the temp directory. You can check this with file_exists() after the file is saved in your script. But I believe what is happening is that subfolder and temp file are removed by the destruct() method of WireTmpDir during PHP shutdown.http://php.net/manual/en/language.oop5.decon.php#language.oop5.decon.destructor If you want the file to persist after the destruction of the WireTmpDir object then it looks like the WireTmpDir::setRemove() method is what you want. $wireTempDir->setRemove(false); 1 Link to comment Share on other sites More sharing options...
Zeka Posted July 8, 2018 Author Share Posted July 8, 2018 Thanks, @Robin S Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now