<?php require_once "conf/top.php"; include_once 'models/class.Doc.php'; if (isset($_GET['id'])) { $id = $_GET['id']; $doc = new Doc($id); $size = $doc->getSize(); $type = $doc->getType(); $name = $doc->getName(); $content = $doc->getDoc(); header("Content-type: {$type}"); header("Content-length: {$size}"); header('Content-Disposition: attachment; filename="' . $name . '"'); header('Content-Transfer-Encoding: binary'); header("Content-length: " . filesize($file)); header('Accept-Ranges: bytes'); @readfile($content); exit; }