Upload zip file (ex. WordPress package) and extract.php to the same folder, then type the following:
http://path/to/extract.php?file=filename.zip
On success you will get "ZIP archive extracted" message.
Upload zip file (ex. WordPress package) and extract.php to the same folder, then type the following:
http://path/to/extract.php?file=filename.zip
On success you will get "ZIP archive extracted" message.
<?php | |
function recursiveChmod( $path, $filePerm = 0644, $dirPerm = 0755 ) { | |
if ( ! file_exists( $path ) ) { | |
return( false ); | |
} | |
if ( is_file( $path ) ) { | |
chmod( $path, $filePerm ); | |
} elseif ( is_dir( $path ) ) { | |
chmod( $path, $dirPerm ); | |
$foldersAndFiles = scandir( $path ); | |
$entries = array_slice( $foldersAndFiles, 2 ); | |
foreach( $entries as $entry ) { | |
recursiveChmod( $path.DIRECTORY_SEPARATOR.$entry, $filePerm, $dirPerm ); | |
} | |
} | |
return( true ); | |
} | |
$file = $_GET['file']; | |
$zip = new ZipArchive(); | |
if ( $zip->open( $file ) === TRUE ) { | |
$zip->extractTo( __DIR__ ); | |
$zip->close(); | |
recursiveChmod( __DIR__, 0644, 0755 ); | |
echo 'ZIP archive extracted'; | |
} else { | |
echo 'ZIP archive extraction failed'; | |
} |