note 21708 deleted from function.header by danbrown

From: Date: Sun, 07 Dec 2008 18:36:45 +0000
Subject: note 21708 deleted from function.header by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-147841@lists.php.net to get a copy of this message
Note Submitter: dpiper at stens dot com ---- For inline images (JPEG for example): header('Content-Type: image/jpeg'); header('Content-Disposition: inline; filename=file.jpg); For attachments (Adobe PDF for example): header('Content-Type: application/pdf'); header('Content-Disposition: attachment; filename=file.pdf); NOTE: In Internet Explorer, the Content-Disposition header is important, otherwise it will be inline. 'Content-Disposition: attachment' will ALWAYS make IE download it. NOTE: In Netscape, if you want to force it to be a download (i.e. not inline), use header('Content-Type: application/octet-stream'). Netscape doesn't appear to care about the Content-Disposition header apart from when it's in an email message, then the header controls behaviour as expected. It's best to be specific about the file you're sending. Don't rely on the interpretation of the browsers in the face of missing or default headers. Content-Length is good to set for downloads, since it will allow the browser to show a progress meter. It has to be accurate otherwise the browser will stall in downloading.

« previous php.notes (#147841) next »