Login   Register  
PHP Classes
elePHPant
Icontem

File: example1.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of M H Rasel  >  Online zip modifier  >  example1.php  >  Download  
File: example1.php
Role: Example script
Content type: text/plain
Description: The example
Class: Online zip modifier
Modify the files in a ZIP archive
Author: By
Last change:
Date: 2009-01-21 23:53
Size: 565 bytes
 

Contents

Class file image Download
<?php
require "zip.class.php"// Get the zipfile class
$zipfile = new zipfile// Create an object
$zipfile->create_dir("."); // Add a subdirectory - must be done.  If a subdirectory is not wanted, just simply add one named "." as shown here
$zipfile->create_file(file_get_contents(__FILE__), "zip.txt"); // Add the data of the file that is wanted, and the full path to it in the zip.

// Allow user to download file
header("Content-type: application/zip");
header("Content-disposition: attachment;filename=\"zip.zip\"");
echo 
$zipfile->zipped_file();
?>