//Создание архива в PHP
function Create_Archive($tmpdir, $uploaddir, $arFiles, $outfilename){

				  if(extension_loaded('zip')){

					$zip = new ZipArchive();			
					$zip_name = $uploaddir.$outfilename.".zip";
					
					$zip->open($zip_name, ZIPARCHIVE::CREATE);
						
					if($zip->open($zip_name, ZIPARCHIVE::CREATE)!==TRUE){
						$result['errors'] = "Error, ZIP creation failed at this time\n";
					}
					
					foreach($arFiles as $file){
						$zip->addFile($tmpdir.$file, $file);
					}
						
					$zip->close();		
						
					if(file_exists($zip_name)){					
						return $zip_name;
					}					
					
				  }else echo "You dont have ZIP extension";

}