PC Nerd Posted September 24, 2007 Share Posted September 24, 2007 Hi guys. Ive got the following code. however its telling me to download itself ( download.php), and not the file in the $_GET data... <?php header("Content-type: application/".$_GET['type'].""); header("Content-Disposition: attachment; ".$_GET['file'].";"); readfile("$_GET['file']"); ?> is this the correct code or do i need to try something different? The data type will change. at the moment the data types are as following: .py, .java, .zip, .js( not sure). We may also be downloading .exe etc. *its a programmign website. Thanks Link to comment https://forums.phpfreaks.com/topic/70442-force-a-download/ Share on other sites More sharing options...
hvle Posted September 24, 2007 Share Posted September 24, 2007 do you have any space or line before <?php ? Link to comment https://forums.phpfreaks.com/topic/70442-force-a-download/#findComment-353952 Share on other sites More sharing options...
PC Nerd Posted September 24, 2007 Author Share Posted September 24, 2007 none..... <?php header("Content-type: application/".$_GET['type'].""); header("Content-Disposition: attachment; ".$_GET['file'].";"); #readfile("$_GET['file']"); ?> thats the entire document Link to comment https://forums.phpfreaks.com/topic/70442-force-a-download/#findComment-353957 Share on other sites More sharing options...
PC Nerd Posted September 24, 2007 Author Share Posted September 24, 2007 bump Link to comment https://forums.phpfreaks.com/topic/70442-force-a-download/#findComment-354344 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.