Iklan

How to Extract Zip or Rar File in Website Control Panel


Some of website control panel FTP such as Dreamhost do not have extract facility to decompress the compressed file such as zip or rar file. To extract them, just put the PHP script below in the folder in a PHP file and run the PHP file:

<?php
$zip = new ZipArchive;
if ($zip->open(“mapserver.zip“)){
$path = getcwd() . “/mapserver/”;
$path = str_replace(“\\”,”/”,$path);
echo $path;
echo $zip->extractTo($path);
$zip->close();
echo ‘Done.’;
} else {
echo “Error”;
}
?>

You should change the mapserver.zip into your own file name and mapserver into your own directory where the file should be extracted.

Iklan

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout /  Ubah )

Foto Google+

You are commenting using your Google+ account. Logout /  Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout /  Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout /  Ubah )

Connecting to %s

%d blogger menyukai ini: