<?php

$zip = new ZipArchive();
$filename = "/GUOKS_".$dname.".zip";

if ($zip->open($filename, ZIPARCHIVE::CREATE)!==TRUE) {
    exit("Невозможно открыть <$filename>\n");
}
//Найти и зацепить директорию
//куда падают файлы *tpo, *xml и папка Images
$zip->open($_SESSION['userdir']."/GUOKS_".$dname.".zip", ZIPARCHIVE::CREATE); 
	$filecontents = file_get_contents($_SESSION['userdir']."/GUOKS_".$dname.".xml");
	$zip->addFromString("GUOKS_".$dname.".xml", $filecontents); 
	$filecontents = file_get_contents($_SESSION['userdir']."/GUOKS_".$dname.".tpo");
	$zip->addFromString("GUOKS_".$dname.".tpo", $filecontents); 
	$zip->addEmptyDir("Images");

	
	
/*
$zip->addFromString("testfilephp.txt" . time(), "#1 Это тестовая строка, добавленная как testfilephp.txt.\n");
$zip->addFromString("testfilephp2.txt" . time(), "#2 Это тестовая строка, добавленная как testfilephp2.txt.\n");
$zip->addFile($thisdir . "/too.php","/testfromfile.php");
*/


echo "numfiles: " . $zip->numFiles . "\n";
echo "status:" . $zip->status . "\n";
$zip->close();

	
	$zip->close();

?>
