How To Unzip a File With PHP?

How To Unzip a File With PHP?

<?php
$unzip = new ZipArchive;
$out = $unzip->open('file-name.zip');
if ($out === TRUE) {
  $unzip->extractTo(getcwd());
  $unzip->close();
  echo 'File unzipped';
} else {
  echo 'Something went wrong?';
}
?>

create a new file called unzip.php and insert this code in there.  Replace file-name.zip with your current zip file then visit the url

Was this article helpful?

Related Articles

Leave A Comment?