Dec 22, 2012

How to Easy Unzip .ZIP File on Ftp Server

How to Easy Unzip .ZIP File on Server
Want to Unzip your Zip file on Your ftp Server and don't Know How to do that then you can use below code.with this code easily unzip any zip file with in some sec only .
Now follow my instruction to know how to use this
  • Open Notepad  and copy/paste below code in it.
<?php

     $zip = new ZipArchive;
     $res = $zip->open('myfilename.zip');
     if ($res === TRUE) {
         $zip->extractTo('myfoldername/');
         $zip->close();
         echo 'ok';
     } else {
         echo 'failed';
     }
?>

  • Replace myfilename.zip with your uploaded zip file name which you want to extract/unzip on server .
  • and myfoldername/ with folder/directory where you want to unzip.
  • Then Save this File with any name but extension must be .php and upload it your server
  • Now Open this uploaded php file in your browser it will automatically extract that zip file
Note:-Directory where you want Unzip that file must be with write permission better You Chmod it with write  permission.

Now all done Enjoy  ..if you like or any Problem with this code then comment below ...

Subscribe Updates, Its FREE!

0 comments:

Post a Comment

 

Copyright @ 2013 EgyTricks.

Designed by Vikash | EgyTricks