Last active
September 23, 2017 20:47
-
-
Save Sanix-Darker/b7218bf205105f14c2d2669b8d75bd80 to your computer and use it in GitHub Desktop.
[PHP] Force a download of a 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
| <?php | |
| if(isset($_REQUEST['src'])){ | |
| $file_name = $_REQUEST['src']; | |
| header('Content-Type: application/octet-stream'); | |
| header("Content-Transfer-Encoding: Binary"); | |
| header("Content-disposition: attachment; filename=\"".$file_name."\""); | |
| readfile('../Your_Path_Here/'.$file_name); | |
| exit; | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment