Created
June 6, 2017 07:41
-
-
Save phannam1412/5dc20012e05fcc9b5a6f5b79c18a2f1c to your computer and use it in GitHub Desktop.
force browser to download file
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
header('Content-Type: application/octet-stream'); | |
header("Content-Transfer-Encoding: Binary"); | |
header("Content-disposition: attachment; filename=\"db.sql\""); | |
// readfile('db.sql'); // do the double-download-dance (dirty but worky) | |
print file_get_contents('db.sql'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment