|  | 
  Mickael T - 2008-01-29 01:05:10Hi,
 I tried to use your library to generate an archive. Here is my source code (photos is an array containing filenames):
 
 $createZip = new createZip();
 $createZip->addDirectory($directory);
 foreach($photos as $photo) {
 $createZip->addFile(file_get_contents($directory.$photo), $directory);
 }
 $file = $gallery.'.zip';
 $fileResource = fopen($file, 'wb');
 $out = fwrite($fileResource, $createZip->getZippedfile());
 fclose($fileResource);
 $createZip->forceDownload($file);
 @unlink($file);
 
 I get an archive, with a correct size, but I cannot open it with 7-zip. It says that it is a "not supported archive".
 
 Do you have any idea of what could be the problem? Thank you.
  Er. Rochak Chauhan - 2008-01-29 06:42:21 - In reply to message 1 from Mickael TWell the difference between all unzipping and zipping utility is the compression algorithm. Rest all is standardI you suggest you to comment all the compression in the class and then try.
 
 Regards,
 Rochak Chauhan
 
  Mickael T - 2008-01-29 09:54:44 - In reply to message 2 from Er. Rochak ChauhanI replaced this first line by the second:$createZip->addFile(file_get_contents($directory.$photo), $directory);
 $createZip->addFile(file_get_contents($directory.$photo), $directory.$photo);
 
 It works! But only with another file archiver (TUGZip), however 7-zip is a powerful and open source file archiver! So where are the lines you suggested me to comment?
 
 Thanks.
 
  pushapraj sharma - 2009-04-29 12:29:11 - In reply to message 1 from Mickael Tuseless class by u
  Er. Rochak Chauhan - 2009-04-30 02:56:10 - In reply to message 4 from pushapraj sharmaIf you are not a part of the solution then you are the part of the problem.
 So be my guest, code a better class yourself or keep your worthless opinions to yourself.
 
 Thanks,
 Rochak Chauhan.
 
 
  Er. Rochak Chauhan - 2009-04-30 02:58:24 - In reply to message 3 from Mickael THi,
 I have updated the class source. You can try the new built or you can just comment this line:
 
 $gzCompressedData = gzcompress($data);
 
 It will just enclose all files in an Zip file without actually compressing it. Let me know if that works.
 
 Thanks and regards,
 Rochak Chauhan,
  Thosapol S. - 2011-06-14 05:47:31 - In reply to message 1 from Mickael TI just solve the same problem. It happen that my text file has foreign language(Thai language) when php readfile in wrong encoding so it's corrupt.
 solution: I add
 
 header("Content-Type: text/html; charset=utf-8");
 
 and it solve!
 |