Reputation: 901
I'm trying to save a file inside php: // output to send it as an answer (it's an excel). The problem is that php does not find the directory, according to the documentation should be able to access it.
i add this validation to my code:
$folderName = 'php://output';
if(!is_dir($folderName)){
throw new FileNotFoundException($folderName . " directory not found.");
}
$objWriter->save($filePath);
and the exception has been throwed and return me:
"php://output directory not found.",
Upvotes: 0
Views: 54
Reputation: 3623
php://output
is not a directory; it's an output stream. You use php://output
to write stuff to the output buffer the same way echo
or print
does. For example, if you wanted to force the browser to display a PDF or an image straight away without saving it first, you would use php://output
.
If you wanted to physically save the file in your filesystem then a proper path must be used.
Upvotes: 2