add_folder ( $source_path, $des_path )

Attached folder, sub-folders and files into compression file.

Usage

require_once 'compress.php'; //attactched source script library compression file into your project.
$zip = new ESCompress(); // initialized ESCompress compression object.
$result = $zip->add_folder('sample1');  // There is a folder attached into compression file.
if(!$result){
    echo 'folder not exist.';
}
$zip->compress('test.zip'); // Compress by using given path.

Parameters

$source_path

(string) (required) absolute or related folder path.

$des_path

(string) (required) folder path which is inside on zip file.

Return Values

(array) Returns true , If has been attached success or fail return (boolean) false .

Example

.1 Attached sub-folders and all files inside of 'sample1' folder by using relative path, with new folder path as secondary parameter inside of compression file.

$result = $zip->add_folder('sample1', 'rename_folder1');  // use relative path to attached into compression file.
if(!$result){
    echo 'folder not exist.';
}

.2 Attached sub-folders and all files are inside of 'sample2' folder by using absolute path. There is used secondary parameter use to give new path, The path has two folder. 'rename_folder2' inside of 'sample' folder and also attached sub-folders and all files into 'rename_folder2' folder after compression.

$result = $zip->add_folder('E:\folder\sample2', 'sample/rename_folder2');  //  use absolute path to attached into compression file.
if(!$result){
    echo 'folder not exist.';
}
2759

published
function () add_file published
function () overwrite published
function () as_new published
function () compress published
function () extract published

What is the codrate ?

codrate.com is a standard, fast cross browsing and highly versatile site. It is useful for many large number of Program Development Industries. So you can get support form Codrators , who are the codrate's joiners around world to help your program developments, You can answer other codrator's questions. Communicate with them. Share your knowledge with them. Do you have an interest in programming, So publish your articles about programming. It will help to maintain your professional co-profile. Actually codrate.com is not such as a regular web site. It will be gave new experience, best narrow cross-browser view, reduce processing time to receive browsing request, it's mean do not wasting your time to browsing codrate's web pages because it has been upgrade always modern coding ways. So, what do you waiting for ?. Try your own.

Copyright 2015 Pride - Company. Design by Esila