The PHP ZipArchive class will let me create a zip archive with the open() method:
mixed ZipArchive::open ( string $filename [, int $flags ] )
I can then add files to this archive, close the file, and download it into the user's web browser as per usual:
header ('Content-Type: application/zip');
header ('Content-Length: ' . filesize ($filename));
header ('Content-Disposition: attachment; filename="' . $filename . '"');
readfile ($filename);
unlink ($filename);
My question: is there a way to avoid creating a file on the server harddisk, downloading that and then erasing it? I.e. is it possible to use stdout as the target filename passed to the open() method and write the archive contents to stdout directly? Something along the lines of:
ZipArchive::open ( STDOUT, ZipArchive::CREATE)
Or am I stuck with the necessity for an intermediate server-side file?