Re: Binary File Download problems.
| From: | Marek Kilimajer | Date: | Fri, 25 Apr 2003 12:09:26 +0000 |
| Subject: | Re: Binary File Download problems. | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-145250@lists.php.net to get a copy of this message | ||
Are you using IE? Then try "inline" instead of "attachment". There are also other issues. This is from phpMyAdmin:
// loic1: 'application/octet-stream' is the registered IANA type but
// MSIE and Opera seems to prefer 'application/octetstream'
$mime_type = (PMA_USR_BROWSER_AGENT == 'IE' || PMA_USR_BROWSER_AGENT == 'OPERA')
? 'application/octetstream'
: 'application/octet-stream';
// Send headers
header('Content-Type: ' . $mime_type);
// lem9 & loic1: IE need specific headers
if (PMA_USR_BROWSER_AGENT == 'IE') {
header('Content-Disposition: inline; filename="' . $filename . '.' . $ext . '"');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
} else {
header('Content-Disposition: attachment; filename="' . $filename . '.' . $ext . '"');
header('Expires: 0');
header('Pragma: no-cache');
}
Rob Lacey wrote:
I use the following headers to send the file (in this instance an mp3 file) --8<--- header("Cache-control: private"); header("Content-Type: application/octet-stream"); header("Content-Length: " . filesize($file_path)); header("Content-Disposition: attachment; filename=" . $filename); --8<--- So you get a download window with the correct filename displayed and everything. tried using header("Content-Type: audio/x-mp3"); which proceeded to stream the file (cool but not the desired effect) so at this point started scratching my head. What is confusing me is that I thought that once the download starts I should really be able to continue browsing as normal, as if I have clicked on a direct link to that file. At least that's what I want to acheive. Thanks. On Friday 25 Apr 2003 12:15 pm, you wrote:What headers do you use? Do you use header("Content-Disposition: attachment; filename=$filename" ); ?