tags:

views:

39

answers:

1

hello,

i create one zip archive via php and another zip archive via winrar, but from the same files.

size of two archives is different. the one via winrar is bigger (2 bytes).

why ? thanks.

OK NOW. zip was created correctly using php.

problem was that i was sending it using

header('Content-Type: application/zip');
header('Content-disposition: attachment; filename='.$name);
header('Content-Length: ' . filesize($name));

and dont have there ob_start(); and ob_end_clean();

that's why the size of file which come via header was different.. anyway thanks for your help ;)

+1  A: 

Could be plenty of reasons. My bet, since it is only 2 bytes, is that winrar adds a special identifying mark to the archive to know it was done by winrar.

The other possibility is that you can set different levels of compression, and your php zip function maybe set to a higher rate of compression. Either or could be true, only way to really find out is to use a hex editor and examine the two files and see where the difference may lay.

The other way to check is by zipping different file sizes (but the same files) and see if the difference is always two bytes. If it is always two bytes, well winrar adds an identifying mark. If it is not, well it is different compression rates.

Brad F Jacobs
problem is, that i can decompress it using winrar. but other person tried to decompress it and got an error mesasge >> warning [pokus_php.zip]: 2 extra bytes at beginning or within zipfile(attempting to process anyway) i tried php ZIPARCHIVE and also some Zip class Based on CreateZipFile by Rochak Chauhan.. i want to use zip file into SCORM, problem is that the one from php is bad, and the one from winrar is good
mmmm
Information that is good to post initially. Can you please post the entire script you are using, as the two extra bytes could simple be caused by whitespaces.
Brad F Jacobs