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 4 of 4
  1. #1
    New Coder
    Join Date
    Dec 2012
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    help me ziparchive

    I have the zip script but i dont have class for zip archive plz help me with class for below script function Create_zip($source,$destination,$overwrite='')
    {
    $zip = new ZipArchive();
    if($zip->open($destination,$overwrite?ZIPARCHIVE::OVERWRITE:ZIPARCHIVE::CREATE)===TRUE)
    {
    $zip->addFile($source);// Add the files to the .zip file
    $zip->close();// Closing the zip file
    }
    }
    Create_zip("../download/$myFile.txt","../download/$myFile.zip");

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,980
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    ZipArchive is a built in class in PHP. You'll need to enable it on version 5.2+, or install the PECL library on an older version. Simply follow the instructions here for the installation (which is very easy for this library): http://php.ca/manual/en/zip.installation.php
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #3
    New Coder
    Join Date
    Dec 2012
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Fou-Lu View Post
    ZipArchive is a built in class in PHP. You'll need to enable it on version 5.2+, or install the PECL library on an older version. Simply follow the instructions here for the installation (which is very easy for this library): http://php.ca/manual/en/zip.installation.php
    @Fou-lu i downloaded the file from http://php.ca/manual/en/zip.installation.php but inside it is in xml file.. What to do and my php version is 5.4 and how to enable zip.. I searched in settings but not found option to enable..

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,980
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    You should have a lot more than that. It should contain all of the source code for the php_zip module.
    You're on a 5.4 version, so you don't need to install the pecl zip. Simply open the php.ini and uncomment the php_zip.dll/so and restart apache.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 


  •  

    Posting Permissions

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