Jump to content

Redirect after download


phpcandy

Recommended Posts

Hey, I'm trying to create a success page for users who download files from my site.

I'm streaming out the PDFs and Doc files using readfile and a group of header functions.

 

I want to show a congrats/success page after then download the files. What is the best way out?

I tried header('Location: $url'); after the readfile but it screws up download.

 

I tried JavaScript onclick in a hyperlink and this also screwed up downloads.

 

Can someone help please?

 

Step 1: User clicks on a hyperlink.

Step 2: brwoser will either prompt user to save/open the file or automatically downloads file.

step 3: Either immediately after download completes or user opts to download i want to present them a "thanks" page.

Link to comment
Share on other sites

why not say "thanks for downloading" on the download page? since you're sending content from php, you can't use header(), as the headers have already been sent. therefore, you'll have to use something on the browser side, javascript i guess. but then you need to know when the download is finished before you display the thank you. i wouldn't do things this way.

Link to comment
Share on other sites

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.