Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function unzip_file($file, $destination){
- // create object
- $zip = new ZipArchive() ;
- // open archive
- if ($zip->open($file) !== TRUE) {
- return false;
- }
- // extract contents to destination directory
- $zip->extractTo($destination);
- // close archive
- $zip->close();
- return true;
- }
- How to use it.
- if(unzip_file($file["name"],'uploads/')){
- echo 'zip archive extracted successfully';
- }else{
- echo 'zip archive extraction failed';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement