redirect header, downloading files question
I need to write some sort of downloading system, I have the login and encryption complete. But the downloading of the file is where I have hit a wall. There can be no javascript, just in case the user has it off.
I need the system to redirect the user to a file for download, which I have accomplished, but then I need the rest of the scripts on the page to complete.
Is there a way to have the file downloaded and then pass control back the script so that it can remove the file and other various clean up?
Thanks
Re: redirect header, downloading files question
You could route the entire file through your script.
Re: redirect header, downloading files question
Are you wanting the script to continue executing after you have sent the redirect header??
If so, then yes, this is possible, you need to make a call to the ignore_user_abort() function.
PHP Code:
ignore_user_abort(true);
header('Location: newlocation.php');
/* rest of script here */
Be careful using this though as you will not recieve any notification of script errors and any output after the connection has been closed is lost in oblivion.
Re: redirect header, downloading files question
Thanks, I will give it a try.