|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
zlib Multiple files in one archive
Hi All,
Is it possible to Zip up more than one file into a single .gz file using zlib? I have been trying the following code which does not seem to work: PHP Code:
Any ideas would be much appreciated Cheers Mike |
|
#2
|
|||
|
|||
|
any luck ?
im trying the same thing! did you solve this problem?
im using gzwrite instead of gzencode |
|
#3
|
||||
|
||||
|
Hi dreamchimney,
I found a class which does it well (see attached). Usage is by the following code: PHP Code:
You will need to alter the code to meet your specific needs but this should get you going. HTH Mike Digital Egg Ltd |
|
#4
|
|||
|
|||
|
hello,
just wondering where you found the file you attached? Was there any more documentation than what was provided? This will be very helpful, but I was wondering if their was a way to unzip the folder aftwerwards? thanks, -jbuckle24 |
|
#5
|
|||
|
|||
|
Folks, fyi ...
A gzipped file contains exactly one file. The usual way to use gzip compression on several files is to put them into a tar archive, which can be done using Archive_Tar ( http://www.devshed.com/Server_Side/...File/page1.html) and to compress the tar file. HTH |
|
#6
|
||||
|
||||
|
Quote:
Not necessarily correct! Look at http://www.ietf.org/rfc/rfc1952.txt . This clearly states in section 2.2 on file formats: Quote:
Albeit I'll agree that the usual way is to do the tar first, and then gzip the result. And this does also provide proper handling of filenames and directories and stuff. As for alternatives, it's not so hard to produce a proper zip file, either using the zlib or (gzip on unix when no zlib available), and neither to process this zipped file. For starters on the format to use, see http://www.pkware.com/products/ente...ers/appnote.txt I've build my own zip/unzip classes already, but they only uses in-memory files, and are not for public view. At least not yet, but I'm seriously thinking of producing zip/unzip classes loosely build on top of zlib. Time will show if I will publish these scripts/classes or not. But back to the original problem, if adding several members (that is several gzdeflated files) into one file, then you need a proper tool to decompress them, and I'm not sure how zlib handles that. But it's possible, so keep trying. ![]() <e>< |
|
#7
|
|||
|
|||
|
You're right, several files are possible. However, gzip considers several members in an archive to be concatenated data. Do other programmes handle that differently?
Thanks for the links. |
|
#8
|
||||
|
||||
|
I've not studied very well which programs does what, but I know that within the header of each member there are (optional) fields to tell the filename. But I don't know which programs (if any/all) sets this filename, and I don't know how cares when reading the file.
As such, it is much wiser to use the tar.gz-format which is publicly known mainly within the unix community, but at a steadily higher degree in Windows as weel (through the use of WinZip, at least). Or to use the PK Zip-file format, which is understood on both platforms. Sorry for not including references to Mac here, but I haven't used that to any extent, but I have a faint idea that the PK Zip-file format is a little more known than tar.gz. What (I think) I do know is that the Mac format of .sit or .hqx(?) are not that widely supported the other way around. (Although WinZip gets most of what you throw at it... ) <e>< |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > PHP Development > zlib Multiple files in one archive |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|