Re: Poskozovani priloh

From: Jiri Matejka <matejka (zavinac)>
Date: Wed, 10 Mar 2010 23:27:58 +0100
Hoj,

já jsem si na své "download" části udělal tenhle kód. Proměnné si snad
snadno doupravíš...

$disposition = "attachment";
if (isset($_SERVER["HTTPS"])):
        header("Pragma: ");
        header("Cache-Control: ");
        header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
        header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
        header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
        header("Cache-Control: post-check=0, pre-check=0", false);
elseif ($disposition == "attachment"):
        header("Cache-control: private");
else:
        header("Cache-Control: no-cache, must-revalidate");
        header("Pragma: no-cache");
endif;
header("Cache-control: private"); // toto je potreba pro IE v "save as"!!!
header("Content-Type: $mime");
header("Content-Disposition:$disposition; filename=\"".trim(htmlentities($name))."\"");
header("Content-Description: ".trim(htmlentities($name)));
header("Content-Length: ".(string)(filesize($path)));
header("Connection: close");
$fd = fopen($path,'r');
fpassthru($fd);
fclose($fd);

DFly



> No jo. ;-) Bodejť by nebyl, když je to trošku přiohnutý příklad odtamtud.
> V PHP taky nejsem nějaký specialista, ale trošku mě nakopnul Kamil s tou
> hlavičkou,
> tak jsem pátral a zkoušel dál. Příklady na odkazu zkusím přelouskat a
> možná některý pomůže.

Received on 10. 03. 2010, 23:27 CET

This archive was generated by hypermail 2.2.0 : 10. 03. 2010, 23:28 CET