extract ( $file_paths, $des_path, $permission )

Extract compressed file.

Usage

require_once 'extract.php'; //attached extracted source script library file into your project.
$extract = new ESExtract(); // initialized ESCompress compression object.
$result = $extract->extract('sample1.zip','extract_folder');  // Extract 'sample1.zip' file into 'extract_folder' folder.
if(!$result){
    echo 'Cannot extract this compressed file.';
}

Parameters

$file_paths

(string | array) (required) absolute or related compressed file path(s).

$des_path

(string) (optional) absolute or related extracted folder path.

$permission

(boolean) (optional) overwrite or clear before extraction.

Return Values

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

Example

.1 Extract into a folder witch is included 'extract.php' file contained folder, If give absolute or related single compressed file path only.

$result = $extract->extract('sample1.zip');  // related single compression file path.
$result = $extract->extract('E:\folder\sample2.zip');  // absolute single compression file path.

.2 Can give different location as absolute or related folder path to extract compressed files as a secondary parameter.

$result = $extract->extract('sample1.zip','E:\folder\sample2');  // extract into absolute folder path.
$result = $extract->extract('E:\folder\sample2.zip', 'sample2');  // extract into related folder path.

.3 Can give different compressed file paths at same time as path array to extract same folder.

$result = $extract->extract(array('sample2.zip','E:\sample3.zip'),'E:\folder\sample');  // extract into absolute folder path.

.4 By default, If extracted folder already exist before extraction. Sometimes same paths have been both files or sub-folders inside of compressed file and extracted folder, those files and sub-folders are overwrote. Copy some files and sub-folders into extracted folder, Those are not exist before extraction. Nothing happen to other files or sub-folders contain in extracted folder.

Mostly, it is not necessary. Much better way to clear extracted folder, If folder exist before extraction. Use third parameter as boolean true. Then every time only contain files or sub-folders witch were copied from compressed file into extracted folder.

$result = $extract->extract('E:\sample3.zip','E:\folder\sample',true);  // extract into absolute folder path.
905

published
function () add_file published
function () add_folder published
function () overwrite published
function () as_new published
function () compress 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