Click here to Skip to main content
15,886,519 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello, i have created a zip file creation program in php and i used ubantu as my os. it works fine on that but when i run that on window it gives me error and not creating any zip file .

Here is the code:


$Zip = new ZipArchive();
$filelocation = 'update';
$Ziplocation = 'ZipVila/ZipEx.zip';
$Zipfolder = 'ZipVila';

$Zip->open($Ziplocation, ZipArchive::CREATE | ZipArchive::OVERWRITE);
$files = scandir($filelocation);

print_r($files);

unset($file[0], $file[1]); // window gives error in this line, it shows object file is not defined.

foreach ($files as $file) {
$Zip->addfile($filelocation."/{$file}", $file);
echo "File Added";
}

$Zip->close();
echo "Zip Closed";
?>

This work totally fine on my ubantu but not running well on my Window
please can anyone tell me what is the error here ?
thanks
Posted
Comments
Mohibur Rashid 29-Aug-15 17:21pm    
What do you mean by not running well?
Vipin Sharma 30-Aug-15 6:22am    
i mean its not running at all. my zip file is not created and also the line unset shows error

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900