Ne-Lexa / php-zip

PhpZip is a php-library for extended work with ZIP-archives.
MIT License
491 stars 60 forks source link

php-zip with AWS S3 #51

Open ghost opened 4 years ago

ghost commented 4 years ago

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.

Ne-Lexa commented 4 years ago

Hello.

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

ghost commented 4 years ago

are you saying it should work ?

i have S3 wrapper installed and working

ghost commented 4 years ago

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.

Ne-Lexa commented 4 years ago

Try ZipFile::saveAsStream.

insign commented 4 years ago

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

qiyinxiaoqiang commented 4 years ago

php:openssl