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:
$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’; } ?>
Basically it extracts the zip file into the directory you specify… make sure the directory you want to extract it to has write permissions. More info on this script is available on the php website
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.
|