Questions tagged [php-zip-archive]

70 questions
0
votes
0 answers

Laravel ZipArchive, file is corrupt and size 0 kb

I want to ask So I have a function to download all files stored in the folder according to the user ID (in zip format using ZipArchive). it works when i run in xampp locally, windows or cpanel shared hosting. but when i want to move it to Apache and…
0
votes
1 answer

Laravel 8, creating zip file for all the images in public folder. Facing file error : ZipArchive::addFile(): Invalid or uninitialized Zip object

I am trying to zip all the files inside my public 'img' folder but I keep getting this error. I have checked many posts on stack overflow and the code seems to be ok. I think I am missing something here. Can some one please…
Abhimanyu Baidya
  • 95
  • 1
  • 1
  • 10
0
votes
0 answers

PHP zip_open and new ZipArchive() causes exit

I have tried this in two different environments, one works one does not. All I am trying to do is open the zip but at the moment I call one of those functions zip_open or new ZipArchive() the code brakes, exits without an error. What could be the…
Lu Blue
  • 335
  • 3
  • 10
0
votes
1 answer

How to extract zip archive in PHP if file encrypted using setEncryptionName

I have created zip with encryption using setEncryptionName, as follows: if($zip->open($zip_destination_real,\ZipArchive::CREATE) === TRUE) { $zip->addFile($filePath_real,'xyz.txt'); $zip->setEncryptionName('xyz.txt', \ZipArchive::EM_AES_256,…
user17469
  • 3
  • 2
0
votes
1 answer

Is it possible to sort directories inside a zip archive while creating it?

I'm creating a zip with multiples directories containing files inside. When i'm creating the zip I have sorted my files and my directories. When I open my zip archive it looks like the directories are sorted alphanumerically whatever i'm doing, so…
Jules
  • 185
  • 1
  • 16
0
votes
2 answers

zip_close() expects parameter 1 to be resource, object given on line 37

I am creating a file to extract zip files . The code snipped checks if the file extension is .zip and then if the file already exists. If not, extract the archive. if($fileExtension == "zip") { if(is_dir("unzips/".$fileName) == false) { …
0
votes
1 answer

PHP- ZipArchive 0 byte files

I'm trying to download a folder as zip but I always get a zip with 0 byte files. I tried all the solutions found on the internet but it did not help. This is the code: $files= scandir($dir); $zip = new ZipArchive(); $tmp_file =…
0
votes
2 answers

Symfony3 : "Attempted to load class "ZipArchive" from the global namespace. Did you forget a "use" statement for "PHPExcel_Shared_ZipArchive"?"

I'm using symfony3 and trying to install/use TwigExcelBundle on my ubuntu16 server for an excel exporting purpose. I can install it by when I try to use I get the following error : "Attempted to load class "ZipArchive" from the global namespace.…
Lacky Raz
  • 1
  • 1
  • 1
0
votes
1 answer

PHP ZipArchive, disable outputs/echos/logs

I am running PHP ZipArchive in an API and it outputs like adding: uploads/AUFIC/ps.csv (stored 0%) in the body of the response when it runs, how can I disable this output from getting printed? Here's the function that contains ZipArchive, it…
Naguib Ihab
  • 4,259
  • 7
  • 44
  • 80
0
votes
0 answers

Cannot read/open zip bigger than 2GB

I'm not able to open a zip file that is bigger than 2GB. Any ideas why is this happening? I'm getting Error code 5 also getStatusString returns Undefined property: ZipArchive::$getStatusString I think is OS issue.
DatBugs
  • 1
  • 2
0
votes
2 answers

using CRON with ZIPArchive object to create zip file-- pemmisions denied

(sorry for my english) Im creating an online form that upon submission take all the data,create zip file (using ZIPArchive) and send email with all the data and included zip file. When i run the php script , it works just fine and zip file is…
am am
  • 21
  • 1
  • 8
0
votes
1 answer

ZIP file won't download and acts weird with php

I'm working on a system in laravel to make a zip full of photos and download it afterwards. I decided i really don't want to use libraries for this(it is necessary), so I must use plain php. my controller code: public function downloadPictures() { …
EdwardMaiden
  • 3
  • 1
  • 8
0
votes
1 answer

How to list subfolders of a folder inside zip file without extracting?

I'm using php ziparchive function to open zip file and want to list all subfolders of a folder located in a zip file. For example... World.zip contains a folder country,foo & bar and I want to list names of all states folder of that country…
Mihir
  • 306
  • 3
  • 18
0
votes
2 answers

How to check if a folder of specific name exists in zip file or not?

I have a zip file that will be open using php ziparchive function and later I need to check if a folder exists inside the zip? For example, I have a file ABC.zip. Check if there is a sub-folder xyz in folder pqr inside zip file, so if extracted it…
Mihir
  • 306
  • 3
  • 18
0
votes
1 answer

An exception of BufferNotEmpty from PHPZip

I got this exception, but there's no other useful details. I'm using mpdf6.1.0, and PHPZip2.0.8 . My code s like below. $zip = new Zip(); $mpdf = null; foreach ($htmlArr as $name=>$html) { if ($mpdf === null) { $mpdf = initializePdf(); …
Frank
  • 67
  • 1
  • 1
  • 10