If you dont have shell access to your server and need to unzip a file on your php server you can use this script. It basically extracts the zip file into the directory you specify. Make sure the directory you want to extract it to has write permissions.
Created
August 1, 2013 05:27
-
-
Save jentanbernardus/6128609 to your computer and use it in GitHub Desktop.
Unzip an uploaded file using php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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'; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment