maennchen/ZipStream-PHP

Stream zip to s3 with correct permissions.

Closed this issue · 1 comments

When I tried to upload a zip archive directly to s3 via stream, I faced the problem of incorrect permissions, so after uploading the file to the cloud, it was not readable. The solution to this problem is to set the correct ACL rights. I hope someone can help. Here is an example:
Author of this code: @RomM1

$path = "s3://{$adapter->getBucket()}/{$this->getArchivePath()}";

$outputContext = stream_context_create([
    's3' => ['ACL' => 'public-read'],
]);

fopen($path, 'w', null, $outputContext);