Dynamic Zip Creation - Suddenly stopped Working

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
chrish
Forum Newbie
Posts: 1
Joined: Fri Dec 19, 2008 3:56 am

Dynamic Zip Creation - Suddenly stopped Working

Post by chrish »

Hi everyone,

I've recently been using a php code to create zip files on the fly, however all of a sudden this morning it has stopped working, even though the file has not been altered - I have tried tirelessly to fix it however I feel I've hit a brick wall!!

The file brings up the 'Zip file download' box and allows me to download it, however the zip file that is downloaded doesn't contain any files, even though it was working fine yesterday!!

Php code is below:

<?php
Header("Content-type: application/zip");
Header('Content-Disposition: attachment; filename="test.zip"');

$zipobject = new ZipArchive();
$zipobject->open("test.zip", ZipArchive::OVERWRITE);
$zipobject->addFile("img.jpg");
$zipobject->close();

echo file_get_contents("test.zip");
unlink("test.zip");
?>


If anyone has any ideas as to why I would be extremely grateful and might allow me to stop tearing out my hair in frustration ;)!!

Many thanks in advance!

Chris
jmut
Forum Regular
Posts: 945
Joined: Tue Jul 05, 2005 3:54 am
Location: Sofia, Bulgaria
Contact:

Re: Dynamic Zip Creation - Suddenly stopped Working

Post by jmut »

Throwing ideas
Is this your system? Have you upgraded system,libraries. If another server...ask if some upgrade hapenned there. step by step debug ZipArchive
error_reporting E_ALL | E_STRICT , display_errors on.
Post Reply