PHP: ZZIPLIB Problem

  • ybh / 216 / Wed, 24 Jun 2009 08:29:00 GMT / Comments (0)
  • Hello-
    I am trying to use the following code to read a zip file, and then save each file within the zip file onto my system. The web server is running RedHat, and I have ZZIPLIB installed. Could anyone shed some light on why the following code is not working?

    function WriteFile($outfile,$writestring)
    {
    $fp = fopen($outfile, "w+");
    fputs($fp, $writestring);
    fclose($fd);
    }

    function ExtractZIPFile($zip_fname,$dir)
    {

    $stamp = date("D m/d/y ... h:i:s A");

    $zip = zip_open($zip_fname);

    if($zip):

    while($zip_entry = zip_read($zip)):
    $fname = zip_entry_name($zip_entry);
    $fsize = zip_entry_filesize($zip_entry);

    if(zip_entry_open($zip, $zip_entry, "r")):
    $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));

    $dest = "$dir/$fname";

    WriteFile($dest,$buf);

    zip_entry_close($zip_entry);
    endif;

    endwhile;

    //close zip file
    zip_close($zip);
    else:
    echo "error opening zip!";
    endif;
    }

    Any help would be greatly appreciated!

    Bryan
  • Keywords:

    zziplib, php

  • http://programming.itags.org/php/355227/«« Last Thread -
  • PHP Questions

    • access element of array

      I would like to copy mysql_fetch_array result to an normal array. What I've done first is, (I w...

      By anon, 7 Comments

    • Access dynamic variable through POST

      My php page takes data from the database such as ID, Date, Value and prints on the screen. About 20 ...

      By mikerh9, 2 Comments

    • Access Denied-phpMyAdmin

      Mark Sargent wrote:> Hi All,> I can access the database from the terminal on Fedora 3,> [ro...

      By marek_kilimajer, 2 Comments

    • access denied!

      Okay, I know that I have to chmod before saving or copying etc but why? The permission is already se...

      By blupherl, 1 Comments

    • Access Denied!

      I have recently begun experimenting with PHP and MySQL. I have put together a sample database and th...

      By acraggs, 5 Comments