/*  $file = informace o souboru, např. z $_FILE  */ 
public function getDoc($file)    
{
$handle = fopen($file["FULLNAME"], "rb");
    $content = fread($handle, $file["FSIZE"]);
   fclose($handle);
   $httpResponse = $this->getHttpResponse();
   $httpResponse->setContentType($file["MIME_TYPE"]);
    $httpResponse->setHeader('Pragma', "public");
    $httpResponse->setHeader('Expires', 0);
    $httpResponse->setHeader('Cache-Control', "must-revalidate, post-check=0, pre-check=0");
    $httpResponse->setHeader('Content-Transfer-Encoding', "binary");
    $httpResponse->setHeader('Content-Description', "File Transfer");
    $httpResponse->setHeader('Content-Length', $file["FSIZE"]);
    $httpResponse->setHeader('Content-Disposition', 'attachment; filename="' . iconv('UTF-8', 'WINDOWS-1250//TRANSLIT', $file['NAME_ORG']) . '"');
    echo $content;
}

 

Vlastimil Pošmura, 2020