kreut Posted August 8, 2011 Share Posted August 8, 2011 Hello, I'm using: header("Content-type: application/octet-stream"); header("Content-Disposition: attachment; filename=\"$filename\""); to download a file from my server. After this happens, I'd like to use header("Location:/index.php") to redirect the user. I'm finding that if I add in the redirect, then this is the only thing that it does (in other words it executes the last header). Is there anyway to have two headers which do 2 different things, namely download and then redirect? Thanks so much, Eric Quote Link to comment https://forums.phpfreaks.com/topic/244234-double-header/ Share on other sites More sharing options...
TeNDoLLA Posted August 8, 2011 Share Posted August 8, 2011 Check this out, there is explained why it does not work like that and what you could possible do about it. http://stackoverflow.com/questions/822707/php-generate-file-for-download-then-redirect Quote Link to comment https://forums.phpfreaks.com/topic/244234-double-header/#findComment-1254406 Share on other sites More sharing options...
kreut Posted August 8, 2011 Author Share Posted August 8, 2011 Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/244234-double-header/#findComment-1254431 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.