26 lines
653 B
PHP
26 lines
653 B
PHP
<?php
|
|
/*
|
|
Author: Riccardo Di Dato
|
|
Creation Date: 04/mar/2016
|
|
*/
|
|
|
|
require_once(dirname(__FILE__). "/load.php");
|
|
|
|
if (array_key_exists("id",$_GET)) {
|
|
$pdfModel = GlobalVariables::get("dao")->getFirst("MediaModel",array("id"=>$_GET['id']));
|
|
$id = $_GET["id"];
|
|
if (!is_null($pdfModel)){
|
|
$localFilePath = GlobalVariables::get("config")->paths->media."/".$id.".".$pdfModel->extension;
|
|
if (SFSManager::fileExists($localFilePath)){
|
|
|
|
header("Content-type: application/octet-stream");
|
|
header('Content-Disposition: attachment; filename="' . $id.".".$pdfModel->extension . '"');
|
|
|
|
echo file_get_contents($localFilePath);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
?>
|