I could swear it worked yesterday. However, now the code below destroys the folder without problems, but creates a new folder with 411 permissions, when it should be 777. My code did it yesterday.
The purpose of this is to fasten the folder, deliver it, delete the images, and then create a new directory for the images.
Can someone tell me what I'm doing wrong or what should I do? Thanks
function delete_directory($dirname) {
if (is_dir($dirname))
$dir_handle = opendir($dirname);
if (!$dir_handle)
return false;
while($file = readdir($dir_handle)) {
if ($file != "." && $file != "..") {
if (!is_dir($dirname."/".$file))
unlink($dirname."/".$file);
else
delete_directory($dirname.'/'.$file);
}
}
closedir($dir_handle);
rmdir($dirname);
return true;
}
$directoryToZip="jigsaw/";
$outputDir="/";
$zipName="jigsaw.zip";
include_once("createzipfile/CreateZipFile.inc.php");
$createZipFile=new CreateZipFile;
$createZipFile->zipDirectory($directoryToZip,$outputDir);
$fd=fopen($zipName, "wb");
$out=fwrite($fd,$createZipFile->getZippedfile());
fclose($fd);
$createZipFile->forceDownload($zipName);
@unlink($zipName);
delete_directory('jigsaw/assets/images/jigsaw_image');
mkdir('jigsaw/assets/images/jigsaw_image','0777');
source
share