
Joshua Townsend - 2007-05-04 00:47:41 -
In reply to message 1 from nadeem ahmed
In your file was named "example.txt", here is how you would create a new ZIP file with "example.txt" in it:
<?php
require "zip.class.php";
$zipfile = new zipfile;
$zipfile->create_dir(".");
$zipfile->create_file(file_get_contents("example.txt"), "example.txt");
// Then, for example, you could save the file as example.zip
$fh = fopen("example.zip", "wb"); // Remember to use the "b" flag when saving non-ASCII files
fwrite($fh, $zipfile-zipped_file()); // Write the contents
fclose($fh); // Close the file
?>
If you need additional help, just ask.