Well most of the time I need to get my client file in my server for development purpose but most of client do not like to provide ssh account or his account is not enabled ssh. So today I found a brilliant code that will archive the files on server using php. Below is the code available. Hope that will help

$zip = new ZipArchive();
$zip_name = "site.zip";
if($zip->open($zip_name, ZIPARCHIVE::CREATE)!==TRUE){ // Opening zip file to load files
$error .= "* Sorry ZIP creation failed at this time
";
}
$zip->addFile('./*');
$zip->close();

This code will archive your full directory very easily.

Leave a Reply

Your email address will not be published. Required fields are marked *