Forum Moderators: coopster

Message Too Old, No Replies

Zip help

         

andrewsmd

12:34 pm on Oct 1, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I am using the pclzip.lib to unzip a file and I have a problem. I have a function to unzip a file to a directory, and you pass in the file name. Right now it unzips the file to a temp directory but that is not important. I can unzip a large file, or unzip multiple files in one zip however, when I try to call this method twice in the same program, it only unzips the first file. Meaning if i call unzipFile(file1.zip); unzipFile(file2.zip); I get the contents of file1.zip but not file2.zip. Does anyone know why, do I need to do some kind of a close or something? Here is my function.
function unzipFile($unzipPath){

include('incl/pclzip.lib.php');

$archive = new PclZip("{$unzipPath}");

if ($archive->extract(PCLZIP_OPT_PATH, 'tempUnzip',
PCLZIP_OPT_REMOVE_PATH, 'install/release') == 0) {
die("Error : ".$archive->errorInfo(true));

}//if

else{

}//else

}//unzipFile

eelixduppy

5:56 am on Oct 6, 2008 (gmt 0)



I'm not familiar with that library. Maybe a web search will give you some examples to follow.

Normally when I need to zip/unzip files I use the respective Unix command.

andrewsmd

11:55 am on Oct 6, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I can't use the exec command with the PHP server I use. I don't know why but it won't execute anything either a command or a file call with the exec function. I have done a web search, that is where I got the unzip library. It works to zip files and unzip one, but no more.