open($path) === true) { //make all the folders for ($i = 0; $i < $zip->numFiles; $i++) { $OnlyFileName = $zip->getNameIndex($i); $FullFileName = $zip->statIndex($i); if ($FullFileName['name'][strlen($FullFileName['name']) - 1] == '/') { create_folder($base_folder.$FullFileName['name']); } } //unzip into the folders for ($i = 0; $i < $zip->numFiles; $i++) { $OnlyFileName = $zip->getNameIndex($i); $FullFileName = $zip->statIndex($i); if (!($FullFileName['name'][strlen($FullFileName['name']) - 1] == '/')) { $fileinfo = pathinfo($OnlyFileName); if (in_array(strtolower($fileinfo['extension']), $ext)) { copy('zip://'.$path.'#'.$OnlyFileName, $base_folder.$FullFileName['name']); } } } $zip->close(); } else echo 'failed to open file'; break; case 'gz': $p = new PharData($path); $p->decompress(); // creates files.tar break; case 'tar': // unarchive from the tar $phar = new PharData($path); $phar->decompressFiles(); $files = array(); check_files_extensions_on_phar($phar, $files, '', $ext); $phar->extractTo($current_path.fix_dirname($_POST['path']).'/', $files, true); break; } break; case 'media_preview': $preview_file = $_GET['file']; $info = pathinfo($preview_file); ?>