mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-11-28 10:30:42 +00:00
add function sendFile()
This commit is contained in:
parent
f71aab5921
commit
ccb56e827c
|
|
@ -586,4 +586,24 @@ function addDirSep($str) { /* {{{ */
|
||||||
else
|
else
|
||||||
return trim($str);
|
return trim($str);
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send a file from disk to the browser
|
||||||
|
*
|
||||||
|
* This function uses either readfile() or the xѕendfile apache module if
|
||||||
|
* it is installed.
|
||||||
|
*
|
||||||
|
* @param string $filename
|
||||||
|
*/
|
||||||
|
function sendFile($filename) { /* {{{ */
|
||||||
|
if(function_exists('apache_get_modules') && in_array('mod_xsendfile',apache_get_modules())) {
|
||||||
|
header("X-Sendfile: ".$filename);
|
||||||
|
} else {
|
||||||
|
/* Make sure output buffering is off */
|
||||||
|
if (ob_get_level()) {
|
||||||
|
ob_end_clean();
|
||||||
|
}
|
||||||
|
readfile($filename);
|
||||||
|
}
|
||||||
|
} /* }}} */
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user