Jump to content

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/105667-script-for-automatic-download-of-file/
Share on other sites

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

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.