Hi,
I have used the similar code as listed in the listing 2.txt
------------------------------------------------------
include_once ($path.'includes/flyzip/flyzip.php');
include_once ($path.'includes/flyzip/functions.php');
unset($file_list);
AddFolder(&$file_list, $path."uploads/temp", "projdwnld");
//AddFolder(&$file_list, $path."uploads/temp",
$path."uploads/projdwnld");
//$DEBUG = true;
if(!isset($DEBUG)) {
$zip = new FlyZip($path."uploads/projdwnld/".'proj'.$id.'.zip');
foreach($file_list as $src => $dest) {
$zip->AddFile($dest, $src);
}
$zip->EchoToClient();
} else {
foreach($file_list as $src => $dest) {
copy($src, $dest);
}
}
---------------------------------------------------------------------------------------------
if I use $DEBUG = true, then the files are successfully coped to the
specified download folder. But when it is not set, it prints the output
on the browser window as
PKPz߄fʀprojdwnld/test.txt㥢岴 q
RqtHΈ̋)-ΏO..(ʏ*)JLΎ-JЋHKMMIrrӓz\\2sRʒz4 Lʹ¬y©dvAbI.Pz߄fʀPKPz߄fʀpro jdwnld/Copy
of test.txt㥢岴 q
RqtHΈ̋)-ΏO..(ʏ*)JLΎ-JЋHKMMIrrӓz\\2sRʒz4 Lʹ¬y©dvAbI.Pz߄fʀPKPz߄fʀ
projdwnld/test.txtPKPz߄fʀ ¢projdwnld/Copy of test.txtPKL
How can I save those files in the single zip file.
I have tested the following code for creation of zip file.
$fname = "proj".$id."-".date("Y-m-d H-i-s").".bz2";
touch($path."uploads/projdwnld/".$fname);
$fp = bzopen($path."uploads/projdwnld/".$fname, "w");
bzwrite($fp, "this is a test");
bzclose($fp);
The abobe code produces the bz2 file.
Chung Leong wrote:
ye*********@gmail.com wrote: I am developing the project management system.
Each Project:
1. Title, description ... , stored in mysql database
2. Upto ten files (initial description), (name in db, file in file
system)
3. Message board, stored in mysql database (1 file per message, message
in db, file in file system)
I need a link (Download Project) which will download all the project
related files, description, message board in the single zip file.
Please suggest any appropriate method about it.
zlib is installed.
That's a problem that I used as an example in my article about the PHP
stream interface:
http://www.phparch.com/sample.php?mid=42