} else { $response['success'] = false; $response['error'] = 'Can\'t save file'; } } echo json_encode($response); break; case 'extract': header('Content-Type: text/event-stream'); header('Cache-Control: no-cache'); ignore_user_abort(); $startedAt = time(); $file = $server->get($_GET['file'], true); $za = new ZipArchive(); $za->open($file); $server->send_msg($startedAt, $za->numFiles); $complete = 0; for ($i = 0; $i < $za->numFiles; $i++) { $entry = $za->statIndex($i); $server->send_msg($startedAt, $entry['name']); if (substr($entry['name'], -1) == '/') { $server->mkdir(dirname($_GET['file']) . '/' . $entry['name']); } else { $server->put(dirname($_GET['file']) . '/' . $entry['name'], $za->getFromIndex($i)); } $complete++; } break; case 'compress': if ($_GET['d']) { if ($_SESSION['download']['name']) {