Link to home
Start Free TrialLog in
Avatar of prsupriya
prsupriya

asked on

ZIP one or more mp3 files using PHP

Hi!,

I need to zip one or more mp3 files using PHP. Can anybody help me to do this?

Thanks in advance,
S:
Avatar of snoyes_jw
snoyes_jw
Flag of United States of America image

You'll need to get a third-party class or addon.  The PECL zip functions are read-only.

Try these:
http://www.phpclasses.org/browse/package/945.html
http://sourceforge.net/projects/phpziplib
http://www.phpconcept.net/pclzip/index.en.php 

or use one of the system functions (system, exec, etc.) to run a zip utility from the command line.
ASKER CERTIFIED SOLUTION
Avatar of jasco4617
jasco4617

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jasco4617
jasco4617

I am sorry, i have the syntax for the zip program wrong....use the following instead:

    exec('$zipPath outoutFile zipFile1 zipFile2 zipFile3');


I put a "-b " in there when i shouldn't have.



I hope this helps
Just to expand on what's been said, the PHP docs have info on this: http://us2.php.net/zip
And I believe I used this in the past with some success: http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=957&lngWId=8
Avatar of prsupriya

ASKER

Hi!  jasco4617,

Thanks for you response.

I used option as -j inorder not to create any subfolders if the zipfile location is given as relative path

 exec('$zipPath -j outoutFile zipFile1 zipFile2 zipFile3');

Thanks,
S: