Login   Register  
PHP Classes
elePHPant
Icontem

Not supported archive

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      Create ZIP File  >  All threads  >  Not supported archive  >  (Un) Subscribe thread alerts  
Subject:Not supported archive
Summary:Archive generated whith createZip: not supported archive (7-zip)
Messages:7
Author:Mickael T
Date:2008-01-29 01:05:10
Update:2011-06-14 05:47:31
 

  1. Not supported archive   Reply   Report abuse  
Picture of Mickael T
Mickael T
2008-01-29 01:05:10
Hi,

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.

  2. Re: Not supported archive   Reply   Report abuse  
Picture of Er. Rochak Chauhan
Er. Rochak Chauhan
2008-01-29 06:42:21 - In reply to message 1 from Mickael T
Well the difference between all unzipping and zipping utility is the compression algorithm. Rest all is standard
I you suggest you to comment all the compression in the class and then try.

Regards,
Rochak Chauhan

  3. Re: Not supported archive   Reply   Report abuse  
Picture of Mickael T
Mickael T
2008-01-29 09:54:44 - In reply to message 2 from Er. Rochak Chauhan
I 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.

  4. Re: Not supported archive   Reply   Report abuse  
Picture of pushapraj sharma
pushapraj sharma
2009-04-29 12:29:11 - In reply to message 1 from Mickael T
useless class by u

  5. Re: Not supported archive   Reply   Report abuse  
Picture of Er. Rochak Chauhan
Er. Rochak Chauhan
2009-04-30 02:56:10 - In reply to message 4 from pushapraj sharma
If 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.


  6. Re: Not supported archive   Reply   Report abuse  
Picture of Er. Rochak Chauhan
Er. Rochak Chauhan
2009-04-30 02:58:24 - In reply to message 3 from Mickael T
Hi,

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,

  7. Re: Not supported archive   Reply   Report abuse  
Picture of Thosapol S.
Thosapol S.
2011-06-14 05:47:31 - In reply to message 1 from Mickael T
I 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!