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
236
votes
29 answers

Fatal error: Class 'ZipArchive' not found in

I have a problem that I install 'Archive_Zip 0.1.1' on Linux server, but when I try to run the script to create the zip file it gives the fatal error Fatal error: Class ZipArchive not found in ... where I put the code $zip = new…
Parag Chaure
  • 2,883
  • 2
  • 19
  • 27
61
votes
6 answers

ZipArchive creates invalid ZIP file

I am trying to create a new ZIP package from code with one entry and save the ZIP package to a file. I am trying to achive this with the System.IO.Compression.ZipArchive class. I am creating the ZIP package with the following code: using…
Mark Vincze
  • 7,737
  • 8
  • 42
  • 81
36
votes
4 answers

Create a zip file using PHP class ZipArchive without writing the file to disk?

I would like to create a zip file in memory using a ZipArchive (or a native PHP class) and read the content of the file back to the client. Is this possible? If so, how? The files that I want to zip in this application are a maximum of 15 MB…
CLJ
  • 1,907
  • 5
  • 22
  • 36
35
votes
6 answers

overwriting file in ziparchive

I have archive.zip with two files: hello.txt and world.txt I want to overwrite hello.txt file with new one with that code: import zipfile z = zipfile.ZipFile('archive.zip','a') z.write('hello.txt') z.close() but it won't overwrite file, somehow…
nukl
  • 10,073
  • 15
  • 42
  • 58
35
votes
6 answers

ZIP all files in directory and download generated .zip

Well, first of all, this is my folder structure: images/ image1.png image11.png image111.png image223.png generate_zip.php And this is mine generate_zip.php:
Ygor Montenegro
  • 659
  • 1
  • 12
  • 26
28
votes
13 answers

PHPExcel_Writer_Exception with message "Could not close zip file php://output."

I'm using PHPExcel to export some data to user in an excel file. I would like the script to send the excel file to the user immediately after it's creation. Here is my test code: try{ /* Some test data */ $data = array( array(1, 10 , 2 …
Pavel L
  • 921
  • 2
  • 9
  • 16
26
votes
14 answers

PHP ZipArchive Corrupt in Windows

I am using PHP's ZipArchive class to create a zip file containing photos and then serve it up to the browser for download. Here is my code: /** * Grabs the order, packages the files, and serves them up for download. * * @param string $intEntryID…
Jesse Bunch
  • 6,651
  • 4
  • 36
  • 59
21
votes
1 answer

Central Directory corrupt error in ziparchive

In my c# code I am trying to create a zip folder for the user to download in the browser. So the idea here is that the user clicks on the download button and he gets a zip folder. For testing purpose I am using a single file and zipping it but when…
mohsinali1317
  • 4,255
  • 9
  • 46
  • 85
18
votes
4 answers

Warning on ZipArchive Close

I am trying to fix an issue in an auto-zip script for some images, which I wrote a while ago and it worked until now. Everything seems fine until $zip->close(); which gives the following: Warning: ZipArchive::close(): Read error: No such…
Ynhockey
  • 3,845
  • 5
  • 33
  • 51
16
votes
5 answers

Extract ZipFile using Python, display Progress Percentage?

I know how to extract a zip archive using Python, but how exactly do I display the progress of that extraction in a percentage?
Zac Brown
  • 5,905
  • 19
  • 59
  • 107
15
votes
5 answers

Composer Install Error: ZipArchive::extractTo(): Full extraction path exceed MAXPATHLEN (260)

When I run: php composer.phar require kartik-v/yii2-widgets "*" I get the following output (using the -vvv verbose flag): - Installing kartik-v/bootstrap-fileinput (v4.1.7) Downloading…
Michael Lawson
  • 161
  • 1
  • 1
  • 4
14
votes
1 answer

Error While Renaming An Extracted Zip File To Other Languages In PHP

I use PHP ZipArchive class to extract a .zip file, It works fine for English, but cause problems in my local language (THAI). I use icov('utf-8','windows-874',$zip->getNameIndex($i)) to convert utf-8 to THAI. It works for folder's/file's name, but…
14
votes
3 answers

php zip archive memory, ram and max file size

I have folders that have user generated images that get rather large. When trying to zip these I am getting errors around 1.5 gig sized zip files. My questions have to do with memory and I think that php is holding both the zip open and all the…
quick_learner42
  • 396
  • 2
  • 4
  • 13
13
votes
1 answer

How am I supposed to use ZipArchive with memory streams?

My problem is that as soon as ZipArchive is disposed, it automatically closes and disposes the MemoryStream. If I look at the stream before the disposal of ZipArchive the information is not well formed zip. using (var compressStream = new…
Csaba Toth
  • 10,021
  • 5
  • 75
  • 121
13
votes
1 answer

Enable ZipArchive on localhost

I need to enable ZipArchive php class on my localhost, How can I enable it !?
iSun
  • 1,714
  • 6
  • 28
  • 57
1
2 3
54 55