Files
ventas_php/util/download.php

33 lines
927 B
PHP
Executable File

<?php
include_once('../config.php');
/*
header('Content-disposition: attachment; filename='.$_GET["filename"]);
header('Content-type: '.$_GET["contentType"]);
readfile(urldecode($_GET["path"].$_GET["secPath"]."/".$_GET["filename"]));
*/
$file = $_GET["filename"];
if ($_GET['contentType'] == 'text/pdf')
$pathFile = DOC_ROOT.'/'.$_GET["secPath"]."/".$_GET["filename"];
else
$pathFile = $_GET["path"].$_GET["secPath"]."/".$_GET["filename"];
if (file_exists($pathFile)) {
header('Content-Description: File Transfer');
header('Content-type: '.$_GET["contentType"]);
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($pathFile));
ob_clean();
flush();
readfile($pathFile);
exit;
}
?>