php-zip icon indicating copy to clipboard operation
php-zip copied to clipboard

php-zip with AWS S3

Open ghost opened this issue 5 years ago • 6 comments

Hi,

i have php-zip working well locally, but will have the need to put my files in AWS S3 storage. I tried to zip a file but it failed...

is the library compatible with AWS S3 ?. The framwwork i'm supports S3 and all files are saved and retrieved successfully.

here's a a sample error:

Fatal error: Uncaught PhpZip\Exception\InvalidArgumentException: File s3://aami-ca-2/uploads/XXXX/YYYY/filename_Package.zip.temp5ea035e27cb4f4.89630193 can not open from write. in X:\vendor\nelexa\zip\src\ZipFile.php:1610 Stack trace: #0

any insight appreciated.

ghost avatar Apr 22 '20 12:04 ghost

Hello.

I did not work with AWS S3. Are you sure you registered their stream wrapper?

Ne-Lexa avatar Apr 22 '20 12:04 Ne-Lexa

are you saying it should work ?

i have S3 wrapper installed and working

ghost avatar Apr 24 '20 00:04 ghost

did some debugging

error occurs in saveAsFile() {} $tempFilename = s3://BUCKET/uploads/2audit_Apr-28-2020_Package.zip.temp5ea87fcbb09140.99052094

error: $tempfilename can not open from write.

ghost avatar Apr 28 '20 19:04 ghost

Try ZipFile::saveAsStream.

Ne-Lexa avatar May 02 '20 06:05 Ne-Lexa

Not a fix, but better alternative is use https://github.com/thephpleague/flysystem

insign avatar Sep 01 '20 01:09 insign

php:openssl

qiyinxiaoqiang avatar Sep 09 '20 05:09 qiyinxiaoqiang