Search This Blog

Wednesday, 23 January 2013

Script to Unzip the GZipped file in PHP

function uncompress($srcName, $dstName) {
    $sfp = gzopen($srcName, "rb");
    $fp = fopen($dstName, "w");

    while ($string = gzread($sfp, 4096)) {
        fwrite($fp, $string, strlen($string));
    }
    gzclose($sfp);
    fclose($fp);
}
uncompress($srcName, $dstName);

No comments:

Post a Comment