Share on Google+Share on Google+

Create a new zip file in ZipArchive.

Creating a new zip file in ZipArchive.

Creating a new Zip file in ZipArchive

For creating zip file, use zipArchive () class. Create a new zip file in ZipArchive. Use the conditional statement to add a file in the ZipArcive class. If the file exists, the create() function will generate a new zip file, in case of failure, it will print failed in creating zip file.

$newzip = new ZipArchive;
$create = $zip->open(’’, ZipArchive::CREATE);
if ($create=== TRUE) {
echo "Zip file successfully created";
} else {
echo "Failed in creating zip file";


Posted on: July 30, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.


Advertisement null