コード例 #1
0
<?php

if (isset($_REQUEST['File']) && !empty($_REQUEST['File'])) {
    define('WP_USE_THEMES', false);
    require '../../../wp-load.php';
    require "create_zip_file.php";
    $uploads = wp_upload_dir();
    $tmp_location = $uploads['path'] . "/" . $_REQUEST['File'];
    //echo $tmp_location;
    $zip = new CreateZipFile();
    $zip->forceDownload($tmp_location, false);
    unlink($tmp_location);
    exit;
}
コード例 #2
0
ファイル: exampleScript.php プロジェクト: TBoonX/SlideWiki
<?php

$fileToZip = "License.txt";
$fileToZip1 = "CreateZipFileMac.inc.php";
$fileToZip2 = "CreateZipFile.inc.php";
$directoryToZip = "./";
// This will zip all the file(s) in this present working directory
$outputDir = "/";
//Replace "/" with the name of the desired output directory.
$zipName = "test.zip";
include_once "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);
コード例 #3
0
 public function actionBackup()
 {
     Yii::import('application.extensions.yii-zip.CreateZipFile');
     $createZip = new CreateZipFile();
     //$createZip->zipDirectory('../ims/protected', '');
     $createZip->zipDirectory('protected/data', '');
     $date = date('d-F-y-h-i');
     $zipFileName = $date . '_ims_backup.zip';
     $handle = fopen($zipFileName, 'wb');
     $out = fwrite($handle, $createZip->getZippedFile());
     fclose($handle);
     $createZip->forceDownload($zipFileName);
     @unlink($zipFileName);
 }