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 8 of 8

Thread: unzip

  1. #1
    Regular Coder
    Join Date
    May 2005
    Posts
    563
    Thanks
    0
    Thanked 3 Times in 3 Posts

    unzip

    I'm trying to unzip a .zip file that is uploaded through a normal form.

    I am on a shared server running PHP 4. I've tried using this

    PHP Code:
    $zip = new ZipArchive;
    if (
    $zip->open($_FILES['images']['tmp_name']) === TRUE) {
        
    $zip->extractTo('/home/alpha/public_html/catalogue/images/');
        
    $zip->close();
        echo 
    'ok';
    } else {
         echo 
    'failed';

    It is uploading fine.

    I get a class non-existent error
    Fatal error: Cannot instantiate non-existent class: ziparchive

    I know what that means, I just don't know how to install it on a shared server with no SSH access.

    Is it possible or is there another way?

  • #2
    Regular Coder
    Join Date
    May 2005
    Posts
    563
    Thanks
    0
    Thanked 3 Times in 3 Posts
    would it be possible to use exec()? if so, what paramaters should I pass?

  • #3
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,778
    Thanks
    19
    Thanked 155 Times in 146 Posts
    just upload the class file, and add a line like this to the beginning of your code:

    PHP Code:
    include 'ZipArchive.class.php'
    or whatever file that contains the class...

    that's all there is to it, unless I'm misunderstanding the problem...


    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!

  • #4
    Regular Coder
    Join Date
    May 2005
    Posts
    563
    Thanks
    0
    Thanked 3 Times in 3 Posts
    There is no class file, the downloads for the ZZiplib are all c files and makefiles.

    http://php.net/zip

  • #5
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,778
    Thanks
    19
    Thanked 155 Times in 146 Posts
    Methinks you need to talk to your hosting provider, and see if they'll install it for you.

    And you might be able to use exec(), but I don't know enough shell to help you there...
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!

  • #6
    Regular Coder
    Join Date
    May 2005
    Posts
    563
    Thanks
    0
    Thanked 3 Times in 3 Posts
    I always seem to solve my own problems on here

    the zip_open, zip_read, zip_entry_open etc functions work, but not on files that have been uploaded, they have to be saved to the server first then read from there.

  • #7
    Senior Coder chump2877's Avatar
    Join Date
    Dec 2004
    Location
    the U.S. of freakin' A.
    Posts
    2,778
    Thanks
    19
    Thanked 155 Times in 146 Posts
    Quote Originally Posted by SeeIT Solutions View Post
    I always seem to solve my own problems on here
    That's not really a bad thing! Glad you sorted it out...
    Regards, R.J.

    ---------------------------------------------------------

    Help spread the word! Like my YouTube-to-Mp3 Conversion Script on Facebook !! :)
    [Related videos and tutorials are also available at my YouTube channel and on Dailymotion]
    Get free updates about new software version releases, features, and bug fixes!

  • #8
    Regular Coder
    Join Date
    May 2005
    Posts
    563
    Thanks
    0
    Thanked 3 Times in 3 Posts
    Ha, I guess it's not, I'm also glad I sorted it out, I have a meeting with my client in the morning and it's 11pm.


  •  

    Posting Permissions

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