Zipping Files

software development

#1

I’m trying to allow users on my website to choose files and have the server zip those files into one file and create a link for downloading the combined files. The dynamic link is easy but I’m having problems finding a way to zip the files. The ideal format would be ‘.zip’, but ‘.gz’ would work too. I found functions in my PHP book for reading ‘.gz’ files but not to compress them. On the web I found the library ‘zip.lib.php’ but it also appeared to only open and read zip files. If anyone could help guide me in right direction or maybe even provide code! I would be very greatful!

Thanks,
Brian


#2

I’m not sure if you can actually create ZIP files on the fly that is easily using OSS as ZIP is a proprietary file format, so I would very much doubt any OS language would have capabilities for creating ZIP.

Your best bet would be tar or any other open compression methods, which there are tens of modules on the CPAN for.

  • wil

#3

If you run php as a CGI, perhaps you could just make a system call to the ‘zip’ command?


#4

[quote]ZIP is a proprietary file format

[/quote]

You weren’t around when SEA sued Phil Katz over the ARC format?

On the very day that Phil released the first version of PKZIP, he published the full specification for the file format and announced that it was available for ANYONE to use it.

Bulletin board sysops were so POed over SEA that they converted everything to ZIP as quickly as they could manage. Within six months, it was hard to find anything but zip.

RIP, Phil, and thanks for all the fish.