Unzip/Extract an uploaded file using php - PHP Views : 301
Tagged in : PHP
Send mail vote down 0 vote down 0
Here is a simple which helps you to Unzip/Extract an uploaded file using php


<?php
$zip = new ZipArchive;
$res = $zip->open('zip_file_name.zip');
if ($res === TRUE) {
$zip->extractTo('dir_name/');
$zip->close();
echo 'Extracted';
} else {
echo 'Failed to Extract';
}
?>


Basically it extracts the zip file into the directory you specify… make sure the directory you want to extract it to has write permissions.
By - Sanju, On - 2010-06-24




    Login to add Comments .