Welcome to WebmasterWorld Guest from 18.104.22.168
//the following script should be executed after the whole file downloaded completely.
mail('firstname.lastname@example.org', 'Download completed', 'body', 'from: email@example.com');
It works without any problem. The readfile function shows the "File download" dialog of IE and I won't receive email until IE downloaded the whole file.
However, I found that I need to use session in this script, so I added session_start() at the beginning of this it:
And suddenly, as long as I execute this script, without finishing the download, I can receive the email message immediately. Why this happened? Is there a way to solve this problem?
output_buffering = On
so there in no " ; " at the beginning of the line
This allows for sending headers from any position in your script
It is done at the cost of a very slightly slow-down of the exec.
However you should not be scared about it unless your script is a huge one with a heavy load of PHP calls.
Don't forget to restart Apache