im trying to view files inline in IE but have the following problem

1, I pass the script the filename that I want to view, like
h++p://localhost/script.php?file=hello.ppt

2, after some logic (security, mime-type switch statement) script.php looks like this

//Begin writing headers
header('Content-type: '.$ctype.';\r\n');
header('Content-Disposition: inline; filename='.$file.';\r\n');

@readfile($file_location);

3, I run the script through IE - everthing works ok - the ppt is open inline great! but when I do a save as from IE's menu it picks up the filename as

script.php?file=hello.ppt or script.ppt instead of hello.ppt

very frustrating

any ideas?

    I know that it's an issue with a certain browser(s) but I can't remember which off the top of my head, but you need to surround the filename in quotes, like so:

    header('Content-Disposition: inline; filename="'.$file.'";\r\n'); 

    Give that a shot.

    EDIT: Also, you might try echo'ing out that line (simply change header to echo) to make sure it looks correct. Just trying to eliminate stupid errors! 🙂

    EDIT2: Do you need the line endings? I haven't seen calls to header() that need line endings... in fact, the manual doesn't use them either. I do believe PHP automatically terminates the header lines for you, so you might be doubling that. In addition, I don't see a terminating semicolon on the manual either. Here's the example from the manual page for [man]header/man:

    header('Content-Disposition: attachment; filename="downloaded.pdf"');
      Write a Reply...