Tags

, , ,


Sometime we need to extract a file on the server, say you don’t have access to shell and you want to extract a zip file, just put this to a php file and upload and run

     $zipObj = new ZipArchive;
     $file = $zipObj->open(’zip_file_name.zip’);
     if ($file == TRUE) {
         $zipObj->extractTo('extract_directory/');
         $zipObj->close();
         echo 'Unzip Successfully';
     } else {
         echo 'Failed to unzip';
     }

Its very simple and available idea everywhere, i jut wrote for note
Done!!! 🙂

Advertisements