Location: PHPKode > projects > Ajax File Manager - AjaxExplorer > ajaxexplorer/script/zip-in.php
<?php

/*
AjaxExplorer Copyright (C) 2007-2008 Syed Mohammad Sidque Tahir Al-Habshi

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Head to
GNU site http://www.gnu.org/licenses/ for license copy.
*/

$access='0108';
include 'core.php';

$zip=new ZipArchive();

$dirc=Post('dirc');
$fold=Post('file');
$list[0]='/';

if($zip->open(($dirs=$root.$dirc.$fold).'.zip', (ZIPARCHIVE::CREATE)))
{
  for($i=0; $i<count($list); $i++)
  {
    if($dir=opendir($dirs.$list[$i]))
    {
      while($file=readdir($dir))
      {
	$file=='.' || $file=='..'? '':(is_dir($zips=$dirs.$list[$i].$file)? $list[]=$list[$i].$file.'/':$zip->addFile($zips, $fold.$list[$i].$file));
      }

      closedir($dir);
    }
  }

  $zip->close();

  echo $fold.'.zip:'.filesize($dirs.'.zip').':'.time();
  $does="Archive\t".$dirc."\t".$fold;
  include 'track.php';
}

?>
Return current item: Ajax File Manager - AjaxExplorer