For a project in PHP, it was necessary to upload data to zip. The data are dynamic and are fairly weighty files. In total, the archive can take up to 800mb.
At the moment, generation is implemented through the ZipAchive class.
...какой-то код до $archive = 'filestorage/temp/'.$fileName; $zip = new ZipArchive(); $zip->open($archive, ZipArchive::CREATE); $files = FilesBank::getFilesInfo($photoIds); foreach($files as &$file) { $zip->addFile($file['phusicalPath'], $file['name']); } $zip->close(); header('Content-Type: application/zip'); header('Content-Length: ' . filesize($archive)); header('Content-Disposition: attachment; filename="'.$fileName.'"'); readfile($archive); unlink($archive); I use an intermediate temp file, as a result, a monstrous delay before downloading in 20-40 seconds.
How can you implement instant file delivery without first creating a tempo file?