HI Mungo,
It looks from your screen shot that you have XP. I have Windows 2000, perhaps that's the issue. Anyway, since I'm not connecting to a database, here is the code I used, but it's the same as yours in syntax:
$fileName='temp.doc';
$fileType='application/msword';
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$fp = fopen($fileName, "r");
$filedata = fread($fp, filesize($fileName));
fclose($fp);
unset($fp);
header ("Accept-Ranges: bytes");
header ("Connection: close");
header ("Content-type: $fileType");
header ("Content-Length: ". filesize($fileName));
header ("Content-Disposition: attachment; filename=\"$fileName\"");
echo $filedata;
And it still does the same thing. It says 'you are saving the file download.php' It does this with .pdf filetypes as well (which is what I'm really shooting for).
On this subject of forcing downloads and headers I've seen as many theories as I've seen people, and there doesn't seem to be a definitive guide out there that takes into account all of the factors -- inline vs. attachment, browser types, etc. etc. -- I had the same difficulty in email attachments though I finally mastered that one.
If the above code works in XP, it's on OS thing, not a browser thing. BTW I have IE version 6.0.2600.
Thanks again
Sam