how to create an empty zip archve by php some thing like new -> zip archive
+5
A:
You were pretty close:
$zip = new ZipArchive();
$zip->open('my-archive.zip', ZipArchive::CREATE);
// To actually save the archive you have to put some file/dir into it
$zip->addFromString('tmp', '');
$zip->close();
You can find out more on PHP's manual pages.
Crozin
2010-08-16 19:38:08
its not create any thing
moustafa
2010-08-16 19:47:54
It seems that you have to add some file/directory to the archive to save it what makes a perfect sense cause what's the point of an empty archive?
Crozin
2010-08-16 22:14:06