note 86209 modified in ref.zip by danbrown

From: Date: Wed, 08 Oct 2008 17:57:07 +0000
Subject: note 86209 modified in ref.zip by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-145185@lists.php.net to get a copy of this message
in regards to the extracting via unzip.lib.php: Don't forget to also put in the file path. Otherwise you end up with a lot of files in the wrong folder... <?php require_once("zip.lib.php"); require_once("unzip.lib.php"); $zip = new SimpleUnzip(); $filename = "myzippedfile.zip"; $entries = $zip->ReadFile($filename); foreach ($entries as $entry){ $fh = fopen($entry->Path .'/'.$entry->Name, 'w', false); fwrite($fh,$entry->Data); fclose($fh); } ?> --was-- in regards to the extracting via unzip.lib.php: Don't forget to also put in the file path. Otherwise you end up with a lot of files in the wrong folder... require_once("zip.lib.php"); require_once("unzip.lib.php"); $zip = new SimpleUnzip(); $filename = "myzippedfile.zip"; $entries = $zip->ReadFile($filename); foreach ($entries as $entry){ $fh = fopen($entry->Path .'/'.$entry->Name, 'w', false); fwrite($fh,$entry->Data); fclose($fh); } http://php.net/manual/en/ref.zip.php

« previous php.notes (#145185) next »