I am trying to create zip file using php package zip stream but it seems like its not creating proper zip, after download i cant be able to open it on mac and windows too, when i checked with online tool it say empty zip. could some body help me in this regard. attached code snippet
$zip = new ZipStreamZipStream(
outputName: 'test.zip',
// defaultEnableZeroHeader: true,
sendHttpHeaders: true,
contentType: 'application/x-zip',
);
$zip->addFile(
fileName: 'hello.txt',
data: 'This is the contents of hello.txt',
compressionMethod : CompressionMethod::DEFLATE,
// deflateLevel: 9
);
return $zip->finish();
i tried with multiple php packages but getting same result with all of them
New contributor
gl licensed is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.