|
|
Joined: Dec 1999
Posts: 30,867
Master Elite Member
|
function Zip($Data, $Password = '') {
$sERR = ''; $sOUT = ''; $R['StatusCode'] = 0; $R['StatusMsg'] = ''; $R['Data'] = ''; $xDesc = array(
0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w") );
if ($Password == '') {$Proc = proc_open('zip', $xDesc, $Pipes);}
else {$Proc = proc_open("zip -P $Password", $xDesc, $Pipes);}
if (is_resource($Proc)) {
fwrite($Pipes[0], $Data);
fclose($Pipes[0]);
while (!feof($Pipes[1])) {
$sOUT .= fgets($Pipes[1], 1024);
}
fclose($Pipes[1]);
while (!feof($Pipes[2])) {
$sERR .= fgets($Pipes[2], 1024);
}
fclose($Pipes[2]);
$return_value = proc_close($Proc);
$R['Data'] = $sOUT;
return $R;
}
$R['StatusCode'] = -1;
return $R;
}
|
|
|
|
Entire Thread
|
Zip() - Used to compress data using the PK zip format.
|
Russ
|
08/11/08 11:47 PM
|
|
|
|