see this http://stackoverflow.com/questions/2190540/adds-an-empty-directory-in-the-archive i cant use that code
function addFolderToZip($dir, $zipArchive, $zipdir = ''){
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
//Add the directory
$zipArchive->addEmptyDir($dir);
// Loop through all the files
while (($file = readdir($dh)) !== false) {
//If it's a folder, run the function again!
if(!is_file($dir . $file)){
// Skip parent and root directories
if( ($file !== ".") && ($file !== "..")){
addFolderToZip($dir . $file . "/", $zipArchive, $zipdir . $file . "/");
}
}else{
// Add the files
$zipArchive->addFile($dir . $file, $zipdir . $file);
}
}
}
Benim için örnek yazınız
the second problem is tooooo complex when i using addfile function its will add and appear in the archive as a file and this great now when i using
$z = new ZipArchive();
$z->open('test.zip')
for ($i=0; $i< $z->numFiles;$i++) {
$aZipDtls = $z->statIndex($i);
echo $aZipDtls['name'];
}
Ben böyle bir klasördeki dosyayı eklerseniz onun şimdi göstermek
$zip->addFile('/path/to/index.txt', 'dir/newname.txt');
it show in the winrar soft a dir then a file but in the code its show it as one file file like that in winrar
dir/
dir/newname.txt
in my php system just only show one file without its dir like that
dir/newname.txt
Bu bir dir yeni bir dosya eklemek için onun imposible demek