Pages

Friday, October 14, 2016

Extract uploaded Zip file


I want to give tips for uploading zip files and extract in destination in with PHPs built in Zip Archive class.

Here is the code that runs in xampp (windows)
if($_POST['submit']) {
$zip = new ZipArchive;
if($_FILES) {
if($zip->open($_FILES['uploadfile']['name'],ZipArchive::CREATE) === TRUE) {
echo 'ok';
} else {
echo 'failed';
}
}
else {
echo 'Error in file Upload';
}
}

No comments:

Post a Comment