Unzip a ZIP FILE FOLDER on a server using PHP - shortest code yet.


/ Published in: PHP
Save to your folder(s)

Unzip a ZIP FILE FOLDER on a server using PHP - shortest code yet.


Copy this code and paste it in your HTML
  1. <?php
  2. $zip = new ZipArchive;
  3. $res = $zip->open('sc.zip');
  4. if ($res === TRUE) {
  5. $zip->extractTo('sc/');
  6. $zip->close();
  7. echo 'ok';
  8. } else {
  9. echo 'failed';
  10. }
  11. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.