Zip Class

From KnowledgeTree Document Management Made Simple

Jump to: navigation, search

The functionality for compressing and archiving files is in a file called compressionArchiveUtil.inc.php.

Zip Class

Initialise the zip object and pass in the name of the folder being zipped / the name of the zip object

 $folderName = $this->oFolder->getName();
 $oZip = new zipFolder($folderName);


To add a folder to the zip file:

 // Pass in the folder object $oFolder
 $oZip->addFolderToZip($oFolder);


The documents contained in the folder must be added individually.

To add a document to the zip file:

 // Pass in the document object $oDocument;
 $oZip->addDocumentToZip($oDocument);


To create the zip file and download it:

 $oZip->createZipFile();
 $oZip->downloadZipFile();
Personal tools