$fileToZip="License.txt";
$fileToZip1="CreateZipFileMac.inc.php";
$fileToZip2="CreateZipFile.inc.php";
$directoryToZip="../images";
$outputDir="/";
$zipName="test.zip";
include_once("CreateZipFile.inc.php");
$createZipFile=new CreateZipFile;
$createZipFile->zipDirectory($directoryToZip,$outputDir);
$rand=md5(microtime().rand(0,999999));
$zipName=$rand."_".$zipName;
$fd=fopen($zipName, "wb");
$out=fwrite($fd,$createZipFile->getZippedfile());
fclose($fd);
$createZipFile->forceDownload($zipName);
@unlink($zipName); `
When I run this code, it creates a zip file test.zip, but when I extract it, I will get all the files inside the folder images, and I do not want this to happen. I just want to get all the files, not in the folder, when extracting. How can I change this code to achieve it? Is there any other way to do this? Thank.
source
share