Uploading files to server is a daily chore every webmaster has to do and if you do it using some ftp client where each and every file and image, no matter how small it might be, is uploaded separately, it’s a real pain. Sometimes, It takes hours to get these files uploaded and even then some files are skipped somehow.
A very easy solution to this tedious task is to upload a compressed zip or tar file and uncompress it on server. If you have SSH access or your hosting control panel provide you extracting your compressed file, it’s very helpful. For instance, CPanel and HSphere provide both zipping and unzipping of files and folders on server. But not all hosting environments allow you to unzip files on server without SSH access.
An easy way to unzip file on server is to use following php script.
Just provide the zip file name and destination folder to extract files in the script and it will extract your files for you saving you hours of uploading headache.
$destination = '/destination'; //blank for root folder
$zip = new ZipArchive;
$zip_file = $zip->open('www.zip');
if ( $zip_file ) {
$zip->extractTo(dirname(__FILE__).$destination);
$zip->close();
echo 'files successfully extracted to
'.dirname(__FILE__).$destination.'
directory.';
}
else {
echo 'No donuts for you. :(';
}
Hope it helps.
Cheers!
Thanks !! it works well for me too !! saved a lot of time 🙂
Thanks Man…It Really Works…