note 70095 added to function.header
| From: | alex dot pleiades at gmail dot com | Date: | Tue, 03 Oct 2006 06:06:03 +0000 |
| Subject: | note 70095 added to function.header | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-117984@lists.php.net to get a copy of this message | ||
Re downloading MP3 content. I think you had a typo with "length" and if you set the
content type to 'audio/MP3' it seems to behave in IE,Firefox,SeaMonkey (Mozilla) and Opera
9
This works for me...
$fileHandle = '../'.$productCode.'.mp3'; // gets it from a spot that you
can't access via a browser
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: audio/mp3");
header("Content-Length: " . (string)(filesize($fileHandle)) );
header("Content-Transfer-Encoding: Binary");
header('Content-Disposition: attachment;
filename="'.$productCode.'.mp3"' );
readfile($fileHandle);
----
Server IP: 203.202.10.60
Probable Submitter: 220.239.93.152
----
Manual Page -- http://www.php.net/manual/en/function.header.php
Edit -- https://master.php.net/note/edit/70095
Del: integrated -- https://master.php.net/note/delete/70095/integrated
Del: useless -- https://master.php.net/note/delete/70095/useless
Del: bad code -- https://master.php.net/note/delete/70095/bad+code
Del: spam -- https://master.php.net/note/delete/70095/spam
Del: non-english -- https://master.php.net/note/delete/70095/non-english
Del: in docs -- https://master.php.net/note/delete/70095/in+docs
Del: other reasons-- https://master.php.net/note/delete/70095
Reject -- https://master.php.net/note/reject/70095
Search -- https://master.php.net/manage/user-notes.php