PHP extract zip file

From , 5 Years ago, written in PHP, viewed 198 times.
URL https://pastebin.vip/view/99902887
  1. <?php
  2.     function unzip($location,$newLocation){
  3.         if(exec("unzip $location",$arr)){
  4.             mkdir($newLocation);
  5.             for($i = 1;$i< count($arr);$i++){
  6.                 $file = trim(preg_replace("~inflating: ~","",$arr[$i]));
  7.                 copy($location.'/'.$file,$newLocation.'/'.$file);
  8.                 unlink($location.'/'.$file);
  9.             }
  10.             return TRUE;
  11.         }else{
  12.             return FALSE;
  13.         }
  14.     }
  15. ?>
  16. // http://www.sharejs.com Use the code as following:
  17. <?php
  18. include 'functions.php';
  19. if(unzip('zipedfiles/test.zip','unziped/myNewZip'))
  20.     echo 'Success!';
  21. else
  22.     echo 'Error';
  23. ?>
  24. //php/8850

Reply to "PHP extract zip file"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website