Then, if it is IE, the "application/force-download" Content-type is sometimes required to show the download box. I have the Cache-Control and Pragma headers sent only if not IE. Only use the Expires header, after all, it will require the file to be downloaded again the next time. IE stores downloads in the Temporary Internet Files folder until the download is complete.Use this if you don't want your PDF to display in the browser (in IE). Anyway, I set the Content-Disposition to attachment because I already know that the box will appear. I know this because once I downloaded a huge file to My Documents, but the Download Dialog box put it in the Temp folder and moved it at the end. If IE requires the file to be downloaded to the Temp folder, setting the Cache-Control and Pragma headers will cause an error! ~Cody example is pretty good BUT in time you use "exit" the parser will still work to decide what's happening next the "exit" 's action should do ('cause if you check the manual exit works in others situations too).Here's how: If using the 'header' function for the downloading of files, especially if you're passing the filename as a variable, remember to surround the filename with double quotes, otherwise you'll have problems in Firefox as soon as there's a space in the filename.
Saving php file in ANSI no isuess but when saving the file in UTF-8 format for various reasons remember to save the file without any BOM ( byte-order mark) support.
Otherwise you will face problem of headers not being properly sent eg.
In the case of redirects, if you forget to terminate your script after sending the header, adding a buffer or sending a character may change which page your users are sent to.
This redirects to 2since the second header replaces the first.
SO MY POINT IS : you should use :'CAUSE all die function does is to stop the script ,there is no other place for interpretation and the scope you choose to break the action of your script is quickly DONE!!!