I'm trying to add empty director to archive, by using the following code in ubuntu3.15 running PHP 5.3.10. But it is creating a zip without empty directory in it. Any idea what's wrong in the code?
$zip = new ZipArchive();
$filename = "/var/www/enteliweb/website/public/test.zip";
if ($zip->open($filename, ZipArchive::CREATE)!==TRUE)
{
exit("cannot open <$filename>
");
}
if($zip->addEmptyDir('newDirectory'))
{
echo 'Created a new root directory';
} else {
echo 'Could not create the directory';
}
$zip->close();