Created
February 12, 2015 08:34
-
-
Save filviu/5dd38224dc22717e1c6b to your computer and use it in GitHub Desktop.
Push a file as a download from php. Useful to force a download on the brain-dead android.
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
<?php | |
$file = 'somefile.txt'; | |
header("Content-Description: File Transfer"); | |
header("Content-Type: application/octet-stream"); | |
header('Content-Disposition: attachment; filename="'.basename($file).'"'); | |
readfile($file); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment