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
3
votes
3 answers

ZipArchive not found but appears to be installed (PHP 7.2)

I'm installing a CMS that requires ZipArchive on an Amazon EC2 instance (Amazon Linux 2). The requirements wizard says ZipArchive is not supported: But if I try to install ZipArchive as per instructions I've found online, the server tells me it's…
user2265915
  • 539
  • 3
  • 11
  • 22
3
votes
1 answer

PHP ZipArchive Was working, but now creates invalid zip files

I used to be able to create dynamic zip files just fine with this: if(isset($_POST['files'])) { $zip = new ZipArchive(); $zip_name = $_POST['name'].".zip"; if($zip->open($zip_name, ZIPARCHIVE::CREATE)===TRUE) { …
justin
  • 43
  • 1
  • 6
3
votes
2 answers

PHP Fatal error: Uncaught Error: Class 'ZipArchive' not found in

I've been struggling with installing zip extension over PHP for a while now. I keep getting an error message while trying to use ZipArchive: PHP Fatal error: Uncaught Error: Class 'ZipArchive' not found in '...' The result of: php -m [PHP…
Imri Barr
  • 1,035
  • 3
  • 12
  • 20
3
votes
1 answer

PHP: ZipArchive::extractTo doesn't working (Errror)

I'm completely at a loss for explaining why this isn't working. $filename = 'zipfile.zip'; $za = new ZipArchive(); $folder = DIR_UPLOAD . $filename; $za->open($folder); $za->extractTo(DIR_UPLOAD . 'unzip/'); $za->close(); Error:…
Miten Patel
  • 121
  • 2
  • 12
3
votes
1 answer

List or extract file from recursive archived file without fully extraction

Is there a way to list all files without extracting all the files? AFAIK, current tools can list dirs/files, but can't handle nested archives. E.g., can I list all the files in archive.tar.gz, and extract only file4 w/o extracting all the files? I…
wang yi
  • 329
  • 2
  • 5
3
votes
1 answer

C# Write image to ziparchive

I'm writing a C# .NET(v4.6.1) WinForms app that will save a file as a System.IO.Compression.ZipArchive. First, I open an image using a SaveFileDialog() method and then I assign it to variable of type System.Drawing.Image. Then I save the file, start…
manicdrummer
  • 161
  • 3
  • 14
3
votes
3 answers

System.MissingMethodException when trying to read ZipFile from ZipArchive C#

I have a C# .NET (v4.6.2) WinForms app where I'm accessing a file that may/may not be a .zip archive that was created using "System.IO.Compression;". I have both "System.IO.Compression" and System.IO.Compress.FileSystem" references in the project…
manicdrummer
  • 161
  • 3
  • 14
3
votes
1 answer

How can I get the valid Entries of a ZipArchive when one them contains illegal characters?

I am using System.IO.Compression to extract the content of some Zip files. The problem is that whenever there is an entry with a filename that contains some Windows' illegal characters then an exception is thrown. I have tried several things but I…
3
votes
1 answer

PHP ZipArchive extractTo issues

So, I'm trying to create a bulk upload feature where a user can upload a single zip file containing a bunch of PDFs which will then get processed and stored on the server etc. So far I have this... $serverpath =…
An0nC0d3r
  • 1,275
  • 13
  • 33
3
votes
0 answers

php zip and download google cloud storage image

I want to click a button to zip and download images from google cloud storage to my computer. I use the following code to download the image from mybucket in cloud storage: The zip file is download successful, but when I open it, show error. Why…
Howard Hee
  • 909
  • 1
  • 13
  • 29
3
votes
3 answers

Size limit on PHP's zipArchive class?

I'm creating a zip file in PHP for the user to download. I get no errors from PHP or from checking the zipArchive class's GetStatusString function. But if I put some files into the archive, then when I try to open it, I get the error "the…
SenorPuerco
  • 871
  • 3
  • 9
  • 19
3
votes
2 answers

ZipArchive php class extract files as root. Why?

I have a php script: $extract_dir = "./"; $extract_file = "extractME.zip"; $zip = new ZipArchive; $res = $zip->open($extract_file); if ($res === TRUE) { $zip->extractTo($extract_dir); $zip->close(); echo "ok"; } else { echo…
ozzWANTED
  • 213
  • 1
  • 3
  • 12
3
votes
2 answers

Download header for zip archive

I'm a real php newbie and i have this code that should allow to create a ziparchive containing the files in the folder where the php file is, give the archive the folder's name, save it in a different folder and download it. $zipname =…
brunogermain
  • 51
  • 1
  • 6
3
votes
2 answers

ZipArchive not installed in xampp?

I have newest version of XAMPP and php version 5.6.3, but I can't use ZipArchive. I've downloaded php_zip.dll and placed it in ext dir, I've added extension=php_zip.dll but after server reset I have warming : "Module 'zip' already loaded" I still…
Mac Umatik
  • 63
  • 1
  • 9
3
votes
2 answers

Debugging zip archive and download

I'd like a bit of help debugging this code. I'm trying to zip some files, which I provide as paths to Ziparchive. I think the zip file is empty, possibly. When I test this on a staging site I get a 'decompression failed' error. When I test this…