note 70000 added to function.header
| From: | info/at/storytellermusic/dot/nl at osu1 dot php dot net | Date: | Fri, 29 Sep 2006 08:46:09 +0000 |
| Subject: | note 70000 added to function.header | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-117822@lists.php.net to get a copy of this message | ||
I've been trying to force a download in IE, but everytime it displayed the MP3 data as text in
my IE window.
None of the suggestions made below worked for me.
I've based the headers on the download of a normal .GIF file. Here's mine, it's very
basic and seems to work on both IE and FireFox.
<?php
header('HTTP/1.1 200 OK');
header('Date: ' . date("D M j G:i:s T Y"));
header('Last-Modified: ' . date("D M j G:i:s T Y"));
header("Content-Type: application/force-download"); // changed to force download
header("Content-Lenght: " . (string)(filesize($filelocation)));
header("Content-Transfer-Encoding: Binary"); // added
header("Content-Disposition: attachment; // added
filename=".str_replace(" ", "", basename($filelocation)).""); //
added to remove spaces in filename when saving, it seemed to cause some problems with spaces.
readfile($filelocation);
?>
----
Server IP: 83.137.20.120
Probable Submitter: 86.82.13.3
----
Manual Page -- http://www.php.net/manual/en/function.header.php
Edit -- https://master.php.net/note/edit/70000
Del: integrated -- https://master.php.net/note/delete/70000/integrated
Del: useless -- https://master.php.net/note/delete/70000/useless
Del: bad code -- https://master.php.net/note/delete/70000/bad+code
Del: spam -- https://master.php.net/note/delete/70000/spam
Del: non-english -- https://master.php.net/note/delete/70000/non-english
Del: in docs -- https://master.php.net/note/delete/70000/in+docs
Del: other reasons-- https://master.php.net/note/delete/70000
Reject -- https://master.php.net/note/reject/70000
Search -- https://master.php.net/manage/user-notes.php