Questions tagged [ziparchive]

ZipArchive is a PHP extension for manipulating zip compressed archives.

ZipArchive provides procedural and object oriented approaches for creating, extracting and editing zip archives. The php manual provides a full documentation for both approaches, while on wikipedia history and technique of zip compression is covered.

818 questions
2
votes
0 answers

How to compress multiple files and split the zip while compressing

Hello so I have searched for this a long time allready and havent found anything about this. I search all the folders in the given folder and create an entry in the ziparchive for each file. It is needed that i keep the fodler structure. This is…
Timo Kal
  • 21
  • 1
  • 4
2
votes
1 answer

How to mock a property of a class in Laravel tests

Im using the ZipArchive class in my laravel 5.6 application for handling zip files. In my tests I have created a mock for the ZipArchive class as follows: $this->zipArchiveMock = $this->createMock(ZipArchive::class); Im able to mock methods on the…
joes
  • 349
  • 1
  • 2
  • 10
2
votes
1 answer

Laravel 5 zipArchive to Storage vs to public

In my Larevel app, I would like to put together some files to a zip file for the client to download. I prefer not to put the zip in the public folder. so I create a "tobedownload" folder in my "/storage" folder and plan to put the zip file there.…
R.L
  • 105
  • 2
  • 11
2
votes
1 answer

Creating zip of all directories and files in the same directory format

I am trying to make zip of array of files in the same directory format as it is in my computer the script I've written is working the only issue is that it is overwriting the first element of directory with the second one only the last element in…
Mohsin Abbas
  • 630
  • 8
  • 29
2
votes
0 answers

PHP 5.6.31 Ziparchive : Invalid or uninitialized Zip object

I am using Ziparchive to extract information from APK file. (I am using php-apk-parser from github) While most of the apks works fine some of them breaks with this error "ZipArchive::extractTo(): Invalid or uninitialized Zip object". I can open…
shaharpan
  • 91
  • 8
2
votes
2 answers

Symfony 3: I can't install ckeditor

When I follow this documentation to "Integrating IvoryCKEditorBundle to Create a WYSIWYG Editor" in my app, I get the following error: [Symfony\Component\Debug\Exception\ClassNotFoundException] Attempted to load class "ZipArchive" from the global…
2
votes
1 answer

In PHP, what means this error : Warning: ZipArchive::close(): Read error: Bad file descriptor in (...)?

I have a PHP script to make a zip with 2 functions : dirToArray : to get all files/empty_folders in an array create_zip : to call dirToArray() and make the zipArchive I got a weird warning which actually makes a real error because my zip archive…
J.BizMai
  • 2,621
  • 3
  • 25
  • 49
2
votes
2 answers

ZipArchive::close(): Read error: Is a directory

I'm trying to figure out this problem but I cannot imagine why it keeps happening. I'm adding files to a ZipArchive and when I try to close it, it get the error that the destination is a directory. But I'm pretty sure it is not. This is the code of…
Simon
  • 52
  • 1
  • 1
  • 6
2
votes
1 answer

ZipArchive does not work in laravel

I have laravel project and whant to add feature for ziping files. I am using php ZipArchive. When I'm trying to create ZIP file using just PHP, I have luck, but when I'm trying with Laravel, zip files does not been created. So I have add: use…
Lusine Martirosyan
  • 79
  • 1
  • 5
  • 14
2
votes
1 answer

Multi line comment in ZipArchive

I am trying to set a multi-line comment with ZipArchive.Below is a simplified demo. setArchiveComment($comment); I then open the zip file with Winrar…
user2650277
  • 6,289
  • 17
  • 63
  • 132
2
votes
2 answers

How can I stream a zip in a zip stream download?

I want to be able to archive (zip, no compression needed, but that is a plus), in memory and stream it, the problem is that I want to create an inner zip in the zip I am streaming, like so: Files: a.txt, b.txt, c.txt Stream download should look…
funerr
  • 7,212
  • 14
  • 81
  • 129
2
votes
1 answer

c# - How can I write a file to memorystream, zip three of those memorystreams, and put that into another memorystream?

First, I want to create three files without actually creating a file like memorystream. I want to compress those three files and put them in a memoeystream. It is possible to put a zip file in memoeystream, but like memorystream, can it actually…
lcy
  • 79
  • 9
2
votes
1 answer

Laravel Zip Archive not downloading in browser

I am trying to zip a bunch of PDFs together and download in the browser, at the moment the PDF files are zipped and downloaded to the folder the PDFs are stored in, not via the users browser and into their download folder, I have a similar (and much…
J Foley
  • 1,038
  • 1
  • 17
  • 30
2
votes
2 answers

ZipArchive::close() returns false even with all permissions in folder

Everything works fine on localhost, but when I try to get this script to work on server I couldn't. I tried to change permission of root and uploads (where uploaded images are and where .zip files should be created) to 777 (I know it's not safe, but…
Nikola Stojaković
  • 2,257
  • 4
  • 27
  • 49
2
votes
1 answer

How to send a zip file from Web API 2 HttpGet

I'm trying to figure it out how to create new zip file from a given folder path, and sending it back to the sender. The need is that the file will be downloaded at the sender that requested it. I've seen alot of answers but none helped me with the…
o.Nassie
  • 133
  • 1
  • 2
  • 8