If you dont have shell access to your server and need to unzip a file on your php server you can use the script below:
<?php
$zip = new ZipArchive;
$res = $zip->open('my_zip_file.zip');
if ($res === TRUE) {
$zip->extractTo('my_extract_to_dir/');
$zip->close();
echo 'ok';
} else {
echo 'failed';
}
?>
One issue I ran into with this script was that I could not modify the files via my ftp program as they did not have permission set for this. In my next entry I will show you the chmod script I used to chmod this directory to the needed permissions.
Comments
extension=php_zip.dll
Once you do that, restart apache and it will work perfectly.
really that was helpful
once again than you ............... ...........
Google led me to the right solution by showing your page as the first search result :)
Very simple and straight to the point.
i was looking 4 this piece of code for an hour and i thought it's gonna be long and difficult but it's so simple and good working ;)
cheers!
Thanks a lot
RSS feed for comments to this post