Php Code To Unzip Files

6 years ago

Few Days Ago some New-In Webmasters Who In One Way Or The other Want to Start Up their Hosting Websites From A Free Hosting, have been Having Problems Trying to Extract Files In the Zip They Have Uploaded, With The Continual Quest of Alternative FTP server, Not Knowing PHP can virtually do Everything for Us.

With All Complains Led, I bring You, PHP: UNZIP SNIPPET a Recode By Sunnex, to Enable you Understand The Full Functionality.

HOW TO USE THIS SHORT CODE TO UNZIP A ZIP ARCHIVE

[quote2]
1. Create a New Php File e.g unzip.php

2. Copy And Paste Below Codes Into The file

[ads4]


//Php Unzip Code Snippet
// @@Editor: SunnEx Fidelis (Waploaded.com)
// For Unziping ZIp Archive Easily

$zip = new ZipArchive; //Php Function to Detect Zip archive
$zipname = 'theziptoextract.zip'; //Change theziptoextract.zip to The Zip file Name You want To Extract
if($zip->open($zipname))
{
for($i=0; $i<$zip->numFiles; $i++)
{
echo 'Filename: '.$zip->getNameIndex($i).'
';
}

if($zip->extractTo(dirname(__FILE__).'')) //The Line shows The file Would Be extracted To same Folder The code Was Created
{ echo '

FILE EXTRACTED

'; }

else{ echo '

ERROR IN FILE ECTRACTING!

';
}

$zip->close();
}
else
{
echo 'Error reading zip-archive!';
}
?>

3. Make sue to Change theziptoextract.zip To The Zip file Name You Want to Extract

4. Now save The File

5. Then Visit for Example Yoursite.com/unzip.php from Your Web Browser

NOTE: You Must Visit The Exact Path Where The Unzip.php is Located in Your site
[/quote2]

With That, You are Done as It will Take Few Minutes or seconds to Do The Extraction

WARNING: For security Reasons, Always Delete unzip.php From Your server after Use, Or rename to What People Cant Think of, Or Better Still CHMOD it to No User Access.

NOTE: To Save you stress Of The Inability of Compress & Extract In free Hosting, You can Purchase a Cheap Hosting for as Low a #300 Or Lower Per Month At Hostmeout.com Enjoi...

if You are Not still Cleared, or Get any Error, Please Lay complains below, and NOTE, this snippet Has already been tested By us, so Settle down while giving Your Trial

Related forums
Forum

#Bet9ja Sure Banker 2 Odds Code For Today Sunday 29/11/2020

18 hours ago
Forum

#Bet9ja Sure Banker 2 Odds Code For Today Saturday 28/11/2020

1 day ago
Forum

#Bet9ja Sure Banker 2 Odds Code For Today Thursday 26/11/2020

3 days ago
Forum

#Bet9ja Sure Banker 2 Odds Code For Today Wednesday 25/11/2020

4 days ago