Primer commit del sistema avantika sin cambios
This commit is contained in:
33
util/download.php
Executable file
33
util/download.php
Executable file
@@ -0,0 +1,33 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user