reenadak icon

extract zip

reenadak | PRO | 02/20/18 07:11:24 PM UTC | 0 ⭐ | 367 👁️ | Never ⏰ | []
PHP |

340 B

|

None

|

0 👍

/

0 👎

    public function extractZip($zipName, $newLocation) {
        $zip = new ZipArchive;
    
        if ($zip->open($zipName) === TRUE) {
            if (substr($newLocation, -1) != '/')
                $newLocation .= '/';
            
            if (!file_exists($newLocation))
                mkdir($newLocation);
            
            return $zip->extractTo($newLocation);
            $zip->close();
        }
        
        return false;
    }

Comments