MockY Posted May 14, 2008 Share Posted May 14, 2008 Right now, when users click a certain link, it takes them to a page that redirects them using meta tags like this: <META HTTP-EQUIV="Refresh" CONTENT="1; URL=http://website.com"> I now also want the user automatically get a file as well. As in, the user clicks the link. The user gets to the new page, gets a prompt asking where to save the file, and automatically gets redirected back to the page they came from. How do I go about to do this? Quote Link to comment https://forums.phpfreaks.com/topic/105667-script-for-automatic-download-of-file/ Share on other sites More sharing options...
DeanWhitehouse Posted May 14, 2008 Share Posted May 14, 2008 if you do this it won't be browser friendly, but what you do is on the page where it redirects to , put <META HTTP-EQUIV="Refresh" CONTENT="1; URL=http://downloadname.com"> then after that header("http://address to go to"); is this what u want?? you may need to add ob_start(); at the beggining Quote Link to comment https://forums.phpfreaks.com/topic/105667-script-for-automatic-download-of-file/#findComment-541392 Share on other sites More sharing options...
MockY Posted May 14, 2008 Author Share Posted May 14, 2008 Lets say you have a link that points to a file. When you click on it, the browser will ask you where you want to download it, or in some cases with PDFs, displayed in the browser. However, I want that link to be to the redirection page so that the user gets redirected to exactly where they came from as well as having the file downloade for them, just as if they clicked a link pointing to the file. The reasoning is because I need to be able to send a code snippet to Google every time someone downloads the file, so that I can keep track of how many downloads AdWords generated. Quote Link to comment https://forums.phpfreaks.com/topic/105667-script-for-automatic-download-of-file/#findComment-541396 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.