Here is what I use to force download:
header("Content-Type: text/plain");
header("Content-Disposition: attachment; filename=$blah[filename]");
header("Pragma: no-cache");
header("Expires: 0");
A download dialog opens and if I do choose "Save" it will be saved fine as expected but if I do choose "Open" to open it locally rather than saving, I get this error:
Cannot find the C:\Documents and Settings[username]\Local Settings\Temporary Internet Files\Content.IE5\QPI94LMY\filename[1].dat file.
Do you want to create a new file?
I believe this dialog should not happen even if I want to open it locally, so what is wrong?