|
Posted by George Pitcher on 04/07/05 15:40
Hi all,
I found the cause of the problem.
01 $zipfile = new zipfile();
02 $zipfile -> add_dir("dir/");
03 $inputpath = "C:\\Program Files\\Apache
04 Group\\Apache2\\htdocs\\egretgui\\includes\\invoices\\";
05 $outputpath = "C:\\";
06 $outfile = $outputpath."inv_".date("Y_m").".zip";
07 if ($handle = opendir($inputpath)) {
08 while (false !== ($file = readdir($handle))){
09 $fn = explode(".",$file);
10 if ($fn[1]=="pdf"){
11 echo $inputpath.$file."<br>";
12 $handle = fopen($inputpath.$file,"r");
13 $filedata = fread($handle, filesize($inputpath.$file));
14 $zipfile -> add_file($filedata, "dir/".$file);
15 }
16 }
17 }
18 $fd = fopen ($outfile, "wb");
19 $out = fwrite ($fd, $zipfile -> file());
10 fclose ($fd);
It was the re-use of the variable '$handle' on line 12. I've now changed
that (and its uses) to '$handle2' and the problem has been solved.
Thanks to all for their suggestions.
George in rainy Oxford
[Back to original message]
|