<?php #this is example will create zip file from folder, file array and single file
//-------------------------------------------------------------------------------
// Before you start please create some files and folders in example dir
//
// -.-(root)
// |
// |-[a]
// | |-file1.txt
// | |-file2.txt
// | |-[b]
// | |-file3.txt
// | |-[c]
// | |-file4.txt
// |-[d]
// |-file5.txt
// |-file6.txt
//
//-------------------------------------------------------------------------------
//-------------------------------------------------------------------------------
// Real code
//-------------------------------------------------------------------------------
require_once("Zipek.class.php");
$where2Save = 'tuZapisz';
$fName = 'letAllBeingsBeHappy.zip';
$zip = new Zipek($where2Save.'/'.$fName,true);
$zip->openfile(ZipArchive::CREATE);
$zip->addFolder('a');
$zip->addFilesFromArray(array('d/file5.txt',array('file'=>'d/file6.txt','folder'=>'dedede','rename'=>'file6.ddd')));
$zip->addFile('d/file5.txt','file7.txt');
$zip->showStatus();
$zip->make();
|