Issue with S3 saving of the zip file
I'm using the latest version as of today (5.5), and this is what happens:
The code I've:
foreach ($files as $file) {
$fileExtension = Str::afterLast($file->path, '.');
// ... definitions of some variables fetching some data
$zipStream->add(
's3://'.config('filesystems.disks.s3.bucket')."/{$file->path}",
"{$filePath}.{$fileExtension}"
);
}
$zipPath = "download_batches/{$downloadBatch->id}";
$zipStream->saveToDisk('s3', $zipPath);
This one works, so is only related to S3 stored zip files:
$zipStream->cacheToDisk('local', $zipPath);
Ok no, anyway the package still broken, adds empty zip files...
I just released v5.6, which fixes an issue with saving a zip file to disk. I think it will resolve the issue you were hitting.
HTTP headers being sent automatically by the underlying zipstream package. I had to suppress those when you don't want a browser download, and are just saving to disk. That should eliminate the "headers already sent" problem.
Let me know if the problem still occurs for you in 5.6.
@jszobody Perfect, will try once I've time with that project, million thanks!