kevin duda - 2008-02-10 01:51:18
Hi there. I love the idea of this class but i'm unable to produce a valid zip. Everything I produce is the correct size, but i suspect is not packed correctly.
here is my code:
<?php
include_once("../include/serve_zip.htm");
$createZip = new createZip;
$createZip -> addDirectory("dir/");
$fileContents = file_get_contents("2007-09-09_tilton_band/2007-09-09_tilton_band-001-proof.jpg");
$createZip -> addFile($fileContents, "dir/2007-09-09_tilton_band-001-proof.jpg");
//file_put_contents("tilton.jpg",$fileContents); //this was added to make sure i was getting the correct image data. I am.
$fileName = "archive.zip";
$fileResource = fopen ($fileName, "wb");
$out = fwrite ($fileResource, $createZip -> getZippedfile());
fclose ($fileResource);
$createZip -> forceDownload($fileName);
@unlink($fileName);
?>
I suspect the problem is with the "dir/" sections. I assumed that this was a method to add a directory structure to the zip file, bt nothing I put in that space works.
By any chance could you post the content of the demo file that's linked in the page? A real-world example would be more enlightening to me, personally.
thanks so much!