PC Nerd Posted September 25, 2007 Share Posted September 25, 2007 Hi, I know you can force a downlaod dialog with headers.... however a) im not sure how to do it and b) my current code doesnt work. Is this corect, or am i completely on the wrong track....thanks for your help in advance. header("Content-type: application/".$_GET['type'].""); header("Content-Disposition: attachment; ".$_GET['file'].";"); readfile("$_GET['file']"); Quote Link to comment https://forums.phpfreaks.com/topic/70629-solved-headers-and-forceing-a-download/ Share on other sites More sharing options...
HuggieBear Posted September 25, 2007 Share Posted September 25, 2007 You're on the right track. Take a look at the user comments on the readfile() manual page for more details. Regards Huggie Quote Link to comment https://forums.phpfreaks.com/topic/70629-solved-headers-and-forceing-a-download/#findComment-354949 Share on other sites More sharing options...
jaymc Posted September 25, 2007 Share Posted September 25, 2007 I use this to for wma files header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: audio/x-ms-wma"); readfile("../AuDiO/$file"); Quote Link to comment https://forums.phpfreaks.com/topic/70629-solved-headers-and-forceing-a-download/#findComment-354983 Share on other sites More sharing options...
jaymc Posted September 25, 2007 Share Posted September 25, 2007 Just make sure the content type is relitive to the mime type of file Quote Link to comment https://forums.phpfreaks.com/topic/70629-solved-headers-and-forceing-a-download/#findComment-354984 Share on other sites More sharing options...
PC Nerd Posted September 25, 2007 Author Share Posted September 25, 2007 hmmmmm m not too familiar with mime types etc. what are they? also, ill be downloading about 5 different file types with my script. eould this pose a poblem? tthankx Quote Link to comment https://forums.phpfreaks.com/topic/70629-solved-headers-and-forceing-a-download/#findComment-355268 Share on other sites More sharing options...
PC Nerd Posted September 26, 2007 Author Share Posted September 26, 2007 bump what are MIME types etc? im not too familiar with this. all i want this script to do is get the file that it is given, and create a download dialog. I dont want it read in the browser (like pdf etc)....? thanks Quote Link to comment https://forums.phpfreaks.com/topic/70629-solved-headers-and-forceing-a-download/#findComment-355505 Share on other sites More sharing options...
HuggieBear Posted September 26, 2007 Share Posted September 26, 2007 bump what are MIME types etc? What happens when you google it? Huggie Quote Link to comment https://forums.phpfreaks.com/topic/70629-solved-headers-and-forceing-a-download/#findComment-355518 Share on other sites More sharing options...
PC Nerd Posted September 26, 2007 Author Share Posted September 26, 2007 thanks, all solved. Quote Link to comment https://forums.phpfreaks.com/topic/70629-solved-headers-and-forceing-a-download/#findComment-355543 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.