note 71759 deleted from function.header by tularis
| From: | tularis@php.net | Date: | Fri, 20 Apr 2007 14:16:11 +0000 |
| Subject: | note 71759 deleted from function.header by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-125628@lists.php.net to get a copy of this message | ||
Note Submitter: michal dot kocarek at seznam dot cz
----
Notice the differences between following headers
1.) <? header('Content-Disposition: inline; filename="presentation.pdf"');
?>
2.) <? header('Content-Disposition: attachment;
filename="presentation.pdf"'); ?>
The second one FORCES the browser (IE, for ex.) to show [Save File As...] dialog. In this (M$
PowerP. Presentation presentation) case, when I click on [Open] button in the dialog, it opens the
program and presentation for edit).
The first one allows browser to display file "inline". In this case, presentation is
displayed on the screen without opening M$ PowerP. Browser does not show [Save File As...] dialog.
Note that you need to send proper headers to browser too.
Best practice to force browser to show [Save File As...] dialog is this:
<?
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="presentation.pdf"');
?>