Created
April 3, 2016 22:57
-
-
Save efiku/6acde9f5f50858e8fd7d10db0421c84d to your computer and use it in GitHub Desktop.
This file contains 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
<?php | |
$file = "file.mp3"; | |
header('Content-Type: application/octet-stream'); | |
header('Content-Disposition: attachment; filename='.basename($file)); | |
header('Expires: 0'); | |
header('Content-Length: ' . filesize($file)); | |
$fp = fopen($file, 'rb'); | |
fpassthru($fp); | |
exit(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Testowane na dockerowym kontenerze nginx + php7, działa jak trzeba.
odradzam dodawanie $_GET jako nazwe pliku, bo.... ktoś Ci zassa cały serwis ;)