Reputation: 111
I want to zip files uploaded by a user to a certain Location. While the upload part works, I have no Idea how to zip the file. I am able to create a zip, but do not now how to actually save it to a disk.
Upvotes: 11
Views: 14580
Reputation: 6968
Simply pass the desired destination path to the zip when creating it:
$path = 'path/to/file.zip';
$zip = new ZipArchive();
$zip->open($path, ZipArchive::CREATE);
// add contents...
$zip->close();
Upvotes: 14
Reputation: 1107
This is gonna surely help you out....These are 2 well explained examples hope it helps ..
Upvotes: 2