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
12
votes
5 answers

Read Xlsx file in PhpSpreadsheet

I want to read an xlsx file that was created in Microsoft Excel, but when I run the following code... $Source_File = "test.xlsx"; $Spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($Source_File); ...I receive the following error: Fatal error:…
Arya
  • 566
  • 2
  • 9
  • 22
12
votes
5 answers

Use MemoryStream and ZipArchive to return zip file to client in asp.net web api

I am trying to return zip file from asp.net web api to client using The following Code: private byte[] CreateZip(string data) { using (var ms = new MemoryStream()) { using (var ar = new ZipArchive(ms, ZipArchiveMode.Create, true)) …
Kob_24
  • 592
  • 1
  • 10
  • 26
12
votes
5 answers

Overwriting previously extracted files instead of creating new ones

There are a few libraries used to extract archive files through Python, such as gzip, zipfile library, rarfile, tarfile, patool etc. I found one of the libraries (patool) to be especially useful due to its cross-format feature in the sense that it…
multigoodverse
  • 7,638
  • 19
  • 64
  • 106
11
votes
3 answers

using zipArchive addFile() will not add image to zip

I've been at this for a while. This actually worked one time, then never again. it simply does not create the zip file. The file does exist. $zip = new ZipArchive(); $filename = "./test" . time() .".zip"; if ($zip->open($filename,…
Vance
  • 121
  • 1
  • 1
  • 5
11
votes
2 answers

PHP Warning ZipArchive::extractTo(): Permission denied

I created an application, which using method extractTo() in class ZipArchive (standard in php) and I tested it on my localhost apache server on Windows 7 without any problem. But after I tried it on some unix production server, it just throws…
Lukáš Jelič
  • 529
  • 3
  • 8
  • 22
10
votes
4 answers

List files in .7z, .rar and .tar archives using PHP

I want to list the files inside an archive, without their extraction. The types of archives I am interested in: .7z (7-Zip) .rar (WinRAR) .tar (POSIX, e.g. GNU tar). .zip (ISO standard, e.g. WinZip) For .zip files, I have been able to achieve…
M.M
  • 2,254
  • 1
  • 20
  • 33
10
votes
2 answers

ZipArchive issue "Error 21 - Is a Directory" in PHP

I'm generating a set of HTML, CSS, and image files and I'm using ZipArchive to compress them into a zip file. I've confirmed that the generated assets are valid, but when I attempt to zip the set of files, the resulting archive file is not able to…
user3658604
  • 101
  • 1
  • 4
9
votes
4 answers

PHP Aborting when creating large .zip file

My php script running on CentOS 5.6 and PHP 5.2.12 using ZipArchive() and successfully creates .zip files over 1.6Gb but not for a larger archive of 2GB or larger - PHP aborts with no apparent error. Nothing in the PHP error log or stderr. The…
blainelang
  • 91
  • 1
  • 3
9
votes
2 answers

ZipArchive not opening file - Error Code: 19

Im having issues with my code being able to open a zip file that i have uploaded and moved into a folder, the zip file uploads fine and you can open it in any Zip program however, when i attempt to open it with ZipArchive to extract the data it…
Clifford Yeti Mapp
  • 189
  • 1
  • 1
  • 10
9
votes
3 answers

ZIP file not being created, but no error gets triggered

I'm using ZipArchive: function zip_dir($source, $target){ $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($source, \FilesystemIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST); $zip = new…
Alex
  • 66,732
  • 177
  • 439
  • 641
8
votes
0 answers

how to fix "Failed to open zip archive '/system/framework/com.qti.location.sdk.jar': I/O Error" error

I am fairly new to android and I am making an activity that has two spinners that populate their drop down items from JSONObjects received from two separate API calls. For some reason i am getting this error. I don't know why I am getting this error…
AndroidNewbie
  • 81
  • 1
  • 4
7
votes
1 answer

Php create zip file (from post attachments wordpress)

I am trying to create a zip file from post attachments in wordpress . I have tried both methods below - but it results in nothing (No error messages , no file created) - What am I doing wrong (again .. ) I do not think that The fact that those are…
Obmerk Kronen
  • 15,619
  • 16
  • 66
  • 105
7
votes
2 answers

Add files and directory to a specific sub directory

I am using the following script to move the files of my directory (in this case My_Theme) to the zip archive wordpress.zip. define('CLIENT_PATH', $_SERVER['DOCUMENT_ROOT'] . '/wp_theme/clients_templates/' . str_replace(' ', '_',…
Reza
  • 513
  • 3
  • 7
  • 20
7
votes
2 answers

PHP ZipArchive what do status values mean?

I am right at the start of trying to write some PHP code to run on a Linux box on an EC2 server that will read files from my S3 bucket, zip them then write the zip file back to the bucket. I have instantly run in to problems with even creating a…
undefined
  • 5,190
  • 11
  • 56
  • 90
7
votes
1 answer

ZipArchive: `failed to open stream: Is a directory`

I keep getting a failed to open stream: Is a directory error while trying to unzip a file with PHP. This is usually an issue with the destination path. However, in my case, the destination is fine: I can unzip different files using the same code, or…
Fabien Snauwaert
  • 4,995
  • 5
  • 52
  • 70
1
2
3
54 55