A short search on Google has lead me to theCreate ZIP File PHP class from Rochak Chauhan.
This class can create ZIP archives from lists of files.
The class provides means to add individual files or whole directories to the list of files packed into a ZIP archive.
The class can generate the packed archive as a string value.
The class can also output the necessary request response headers to serve the generated ZIP archive for download.
The supplied example demonstrates how to use the class to store the ZIP archive in a file, serve it for download and delete the file after it is served.
$fileContents = file_get_contents("img.jpg");
$createZip -> addFile($fileContents, "dir/img.jpg");
$fileName = "archive.zip";
$fd = fopen ($fileName, "wb");
$out = fwrite ($fd, $createZip -> getZippedfile());
$createZip -> forceDownload($fileName);
This entry was posted by Will on March 12, 2011 at 3:01 am, and is filed under Uncategorized. Follow any responses to this post through RSS 2.0.
You can leave a response or trackback from your own site.
Your email address will not be published. Required fields are marked *
You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>