phpcandy Posted August 28, 2008 Share Posted August 28, 2008 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. Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted August 28, 2008 Share Posted August 28, 2008 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. Quote Link to comment Share on other sites More sharing options...
phpcandy Posted August 28, 2008 Author Share Posted August 28, 2008 Well, because there aren't easy ways to do this from server-side, I'm sticking to popups! Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted August 28, 2008 Share Posted August 28, 2008 i'm saying is that there isn't an easy way to do it from any side, server or browser (pop-ups). the problem is "after they download the file." how do you know when that is? do you have an example from another site that we could dissect? Quote Link to comment Share on other sites More sharing options...
tibberous Posted August 28, 2008 Share Posted August 28, 2008 You would need a way to know when the've stopped downloading... this should be possible since the download is running from a server - I'm guessing you'd need to use command line functions... Quote Link to comment 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.