Reply to RE: [PHP] zipfile problems - SOLVED

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация