Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Extract Zip Files in PHP

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

About StudentProjects.Live

A collection of source codes that I wrote in VB 6.0, ASP.NET, PHP, C#.NET, VB.NET and JAVA in a course of my career as web developer and software engineer that I would like to share to my fellow programmers. Some of the codes here is not my original work that I found over the Internet and Books while I'm learning how to program. I hope you find my work useful in your learning in programming. Please share my work to other people also who interested to learn the basics of web development and programming. Thank you very much and Happy Productive Programming Everyone.

Follow Me