Forum Moderators: coopster

Message Too Old, No Replies

Zip help

         

andrewsmd

1:40 pm on Oct 3, 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

omoutop

2:07 pm on Oct 3, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



do you use various 'file_' functions?
if you do, clearstatcache() might do the trick for you

unzipFile(file1.zip);
clearstatcache();
unzipFile(file2.zip);
clearstatcache();
.
.
.

andrewsmd

3:30 pm on Oct 3, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I do, I'm going to try that.

andrewsmd

3:43 pm on Oct 3, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That didn't work here is what is weird. If I call it once and run and echo"test"; right afterwords I will get the test. However, if I call it twice it errors on me.