Bu dün çalışıyordu yemin edebilirim. Şimdi ise aşağıdaki kod ile hiçbir sorun klasörü yok ama 777 olması gerekirken 411 izinlere sahip yeni bir klasör oluşturur. Benim kod dün bu yapıyordu.
Bunun amacı, bir klasörü zip teslim, görüntüleri silmek, daha sonra görüntüler için yeni bir dizin yaratmak için olduğunu.
Birisi ben ne yapmaları gerektiğini ben yanlış yapıyorum bana ya misin? Teşekkürler
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/"; // This will zip all the file(s) in this present working directory
$outputDir="/"; //Replace "/" with the name of the desired output directory.
$zipName="jigsaw.zip";
include_once("createzipfile/CreateZipFile.inc.php");
$createZipFile=new CreateZipFile;
/*
// Code to Zip a single file
$createZipFile->addDirectory($outputDir);
$fileContents=file_get_contents($fileToZip);
$createZipFile->addFile($fileContents, $outputDir.$fileToZip);
*/
//Code toZip a directory and all its files/subdirectories
$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);
delete_directory('jigsaw/assets/images/jigsaw_image');
mkdir('jigsaw/assets/images/jigsaw_image','0777');