koopi Posted October 20, 2017 Share Posted October 20, 2017 Hi guys, I need help with a script i'm trying to run. I want to include few headers is the same script: header ('Location:http://www.google.com'); header("Content-disposition:attachment; filename=file.txt"); header("Content-type:application/txt"); readfile("file.txt"); But if i run the scrpit it's only enters to google and ignore the other headers (that force download file.txt). I need that the user will access google and also will be prompted to download the file.txt in parallel. Quote Link to comment https://forums.phpfreaks.com/topic/305405-headers-problem/ Share on other sites More sharing options...
requinix Posted October 20, 2017 Share Posted October 20, 2017 You cannot do both at the same time. Have the source page do two requests: one to your script to download the file, then after another to perform the redirect (which you might as well just do in the Javascript). Quote Link to comment https://forums.phpfreaks.com/topic/305405-headers-problem/#findComment-1552867 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.