in reply to displaying excel/pdf files in browser

I found a little line that seems to be helping the reports display correctly.

print "Content-type: application/vnd.ms-excel\n"; # The Content-Disposition will generate a prompt to save the fil +e. If you want # to stream the file to the browser, comment out the following l +ine. print "Content-Disposition: attachment; filename=$name\n";


Has anybody used this before? If so, is there any documentation available on its proper use?
Prince99

Too Much is never enough...

Replies are listed 'Best First'.
Re: Re: displaying excel/pdf files in browser
by IDStewart (Acolyte) on Feb 27, 2002 at 20:19 UTC
    I've used Content-Disposition for both .ZIP and .EXE. Works like a charm. The user will be prompted to download the file, the the filename will be set to the value of $name.

    Of course, this doesn't help any with the original problem of displaying .XLS and .PDF files in a web browser...

      I have found Content-Disposition specific to certain browsers - it is usually only Explorer that ignores the Content-Type in favour of the file extension ...

      /J\