Files
Yuba/web/handle_zip.php
2019-04-27 00:48:25 -07:00

27 lines
618 B
PHP

<?
$types['txt'] = "text/plain";
$types['log'] = "text/plain";
$types['csv'] = "text/plain";
$types['webloc'] = "application/xml";
$types['svg'] = "image/svg+xml";
//$types['rtf'] = "application/rtf";
$types['rtfd'] = "application/rtf";
$types['doc'] = "application/msword";
$types['docx'] = "application/msword";
require "togggle.php";
$zip = new ZipArchive;
$zip->open($_GET['file']);
$stat = $zip->statIndex(0);
if (!$mime = $types[pathinfo($stat['name'],PATHINFO_EXTENSION)]) {
$mime = "text/plain";
}
header("Content-Type: ".$mime);
header("Content-Length: ".$stat['size']);
echo $zip->getFromIndex(0);
?>