Skip to content

Instantly share code, notes, and snippets.

View Rbn3D's full-sized avatar

Rubén Vallejo Rbn3D

View GitHub Profile
@Rbn3D
Rbn3D / unzip.php
Last active July 8, 2016 07:30 — forked from trajche/unzip.php
Unzip a file outside web root (upper folder)
<?php
$unzip = new ZipArchive;
$out = $unzip->open('file-name.zip');
if ($out === TRUE) {
$unzip->extractTo(realpath(getcwd() . '/../'));
$unzip->close();
echo 'File unzipped to '.realpath(getcwd() . '/../');
} else {
echo 'Something went wrong?';
}