add file pdf

This commit is contained in:
Andrey Kuvshinov
2020-04-07 18:13:53 +03:00
parent 4bd943df22
commit 1b23943dfa

View File

@@ -11,6 +11,44 @@ function priceid_kuri($id){
} }
function file_kuri($hash) {
// $price = db_get("SELECT `pricename` FROM price WHERE `pricehash` = $hash LIMIT 1");
// $id = $price['price_id'];
// $pdffile = "/vhosts/an/httpdocs/files/pdf/pdf/$id.pdf";
$pdfile = '/vhosts/anpdf/app/pub/files/promo.pdf';
$request = $_SERVER['REQUEST_URI'];
$filename = basename($request);
if (file_exists($pdfile)) {
if (ob_get_level()) {
ob_end_clean();
}
header("Content-Type: application/pdf; charset=UTF-8");
header("Content-Length: ".filesize($pdfile));
header("Content-Disposition: attachment; filename=\"{$filename}\"");
header("Content-Transfer-Encoding: binary");
header("Cache-Control: must-revalidate");
header("Pragma: no-cache");
header("Expires: 0");
readfile($pdfile);
}
return;
}
function addhash_kuri(){ function addhash_kuri(){
@@ -31,3 +69,5 @@ function addhash_kuri(){
} }
} }