Created
September 5, 2015 12:53
-
-
Save flowtwo/68f7a189666e662b3686 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Force download of documents due to bug in version 1.9.4 | |
* Open bg-group-documents/include/filters.php and replace line 117-131 with this: | |
*/ | |
$file_name = basename( $doc_path ); | |
switch( strtolower( substr( strrchr( $file_name, '.' ), 1 ) ) ) { | |
case 'pdf' : $mime = 'application/pdf'; break; | |
case 'zip' : $mime = 'application/zip'; break; | |
case 'jpeg': $mime = 'image/jpg'; break; | |
case 'jpg' : $mime = 'image/jpg'; break; | |
case 'png' : $mime = 'image/jpg'; break; | |
default: $mime = 'application/force-download'; | |
} | |
header('Pragma: public'); | |
header('Expires: 0'); | |
header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); | |
header('Cache-Control: private',FALSE); | |
header('Content-Type: '. $mime ); | |
header('Content-Disposition: attachment; filename="'. basename( $file_name ) .'"'); | |
header('Content-Transfer-Encoding: binary'); | |
header('Connection: close'); | |
readfile( $doc_path ); | |
exit; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment