Extract Zip Files in PHP
<?php function fun_zip_file($zip_file_name,$extract_path) { $zip = new ZipArchive; $res = $zip->open($zip_file_name); if ($res === TRUE) { $zip->extractTo($extract_path); $zip->close(); echo 'Zip File Extracted successfully..'; } else { echo 'Failed to Extract Zip File'; } } //"samplezipfile.zip" is the name of the zip file and "extracted_file/" File extract location echo fun_zip_file('samplezipfile.zip','extracted_file/'); ?>
Leave a reply