Skip to content

Instantly share code, notes, and snippets.

@tenomoto
Last active October 19, 2017 09:04
Show Gist options
  • Save tenomoto/9aadc4cbb6083b68a5681c6503367831 to your computer and use it in GitHub Desktop.
Save tenomoto/9aadc4cbb6083b68a5681c6503367831 to your computer and use it in GitHub Desktop.
X-SendFile
# pkg add the following line. uncomment it to enable mod_xsendfile
LoadModule xsendfile_module libexec/apache24/mod_xsendfile.so
# turn XSendFile on and specifiy the path
XSendFile On
XSendFilePath /usr/local/www/xsendfilepath
<?php
$filepath = "/usr/local/www/xsendfilepath/xsendfile.pdf";
header('Content-Type: application/pdf');
header('Content-Size: '.filesize($filepath));
header('X-Sendfile: '.$filepath);
exit;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment