Welcome Guest, Not a member yet? Register   Sign In
Missing files when using Zip Encoding Library
#1

[eluser]captainredmuff[/eluser]
Hi guys,

I've had a good read/search through the CI forums and have found a few mentions of errors when using the Zip Encoding Library (CI 1.7.0) but no direct fixes to resolve the problem.

The issue i'm having is that the resulting zip file created by the library is empty when using the following code snippet:

Code:
//set the path to the backup folder (example file path)
$backup_path = "path/to/files/";

//load the zip library
$this->load->library('zip');

//read contents of backup folder and archive into a zip file
$this->zip->read_dir($backup_path);

//send contents of zip to be downloaded
$this->zip->download("backup.zip");

I have checked the file path is valid and can quite easily work with the directory and the contents externally from the Zip library but after compiling, downloading and opening the zip file, i get an error saying that the contents of the file have been blocked (Windows XP) and no errors at all on Mac OS X.

The closest i have come to a fix for this is a post i found which also outlines the same problem:

Possible Bug in Zip Class

The author supplies a temporary fix which indeed does work, but neglects to maintain the directory structure of the zip meaning that all the files are simply placed into the root directory which, whilst it does work, is not what i require.

I have spent a few hours this morning attempting to create a workaround as suggested by the author of the aforementioned post but have been unable to make any progress. Has anyone else encountered this problem and applied a successful fix? It looks like i may have to spend the afternoon extending and overloading the CI_Zip Library in hope that i can resolve this issue.

Additionally, for further clarification, this problem also exists when using:

Code:
//archive contents of the backup folder and save as a .zip on the server
$this->zip->archive($backup_path . "backup.zip");

The resulting .zip file is always empty, unless employing the aforementioned "fix" ofc.

Thanks for reading, any help would be greatly appreciated Smile

Edit: fixed a type in the code snippet


Messages In This Thread
Missing files when using Zip Encoding Library - by El Forum - 01-08-2009, 06:49 AM
Missing files when using Zip Encoding Library - by El Forum - 01-09-2009, 03:48 AM
Missing files when using Zip Encoding Library - by El Forum - 01-12-2009, 04:11 AM
Missing files when using Zip Encoding Library - by El Forum - 01-15-2009, 05:58 AM



Theme © iAndrew 2016 - Forum software by © MyBB