Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Sep 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Lightbulb how to create and download the zip file(s) in php?

    Hello every one!

    Can you please help me.. how to create and download the zip file(s) online in php?

  • #2
    Regular Coder
    Join Date
    Mar 2006
    Posts
    238
    Thanks
    3
    Thanked 37 Times in 37 Posts
    I think you could try one of the PHP functions like exec(), system(), shell_exec() to execute a command via shell and zip a file. Under Linux it would be something like this:
    Code:
    zip archive_name.zip filename_to_zip
    Wildcard could be used in place of filename_to_zip.

    If you have SSH access, you could run under Linux:
    Code:
    man zip
    to see the reference on the zip command (provided your hoster allowed "man" via SSH - some hosting companies do not)

    If shell commands are not allowed by your hosting company for security reasons, you would need to look for a 3rd party solution (probably written in PHP script which allows zipping).

  • #3
    Senior Coder djm0219's Avatar
    Join Date
    Aug 2003
    Location
    Wake Forest, North Carolina
    Posts
    1,292
    Thanks
    4
    Thanked 202 Times in 199 Posts
    Modern versions of PHP include the ZIP library class which makes it very easy to manipulate ZIP files.
    Dave .... HostMonster for all of your hosting needs

  • Users who have thanked djm0219 for this post:

    SKDevelopment (09-17-2009)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •