/ Published in: PHP
URL: http://www.mechanicmatt.com
Expand |
Embed | Plain Text
<?php /* By: Matt Ford Purpose: Basic class to create zipfiles */ class zipFile { public $settings = NULL; "name" => "", "numFiles" => 0, "fullFilePath" => "" ); private $fileHash = ""; private $zip = ""; public function __construct($settings) { $this->zipFile($settings); } public function zipFile($settings) { $this->zip = new ZipArchive(); $this->settings = new stdClass(); foreach ($settings as $k => $v) { $this->settings->$k = $v; } } public function create() { $this->fileInfo["name"] = $this->fileHash . ".zip"; $this->fileInfo["fullFilePath"] = $this->settings->path . "/" . $this->fileInfo["name"]; false, "already created: " . $this->fileInfo["fullFilePath"] ); } else { $this->zip->open($this->fileInfo["fullFilePath"], ZIPARCHIVE::CREATE); $this->addFiles(); $this->zip->close(); true, "new file created: " . $this->fileInfo["fullFilePath"] ); } } private function addFiles() { foreach ($this->files as $k) { } } } ); $zipFile = new zipFile($settings); "./images/navoff.jpg", "./images/navon.jpg" ); if ($success === true) { //success } else { //error because: $error } ?>
You need to login to post a comment.
