note 70095 deleted from function.header by tularis
| From: | tularis@php.net | Date: | Fri, 20 Apr 2007 14:20:39 +0000 |
| Subject: | note 70095 deleted from function.header by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-125637@lists.php.net to get a copy of this message | ||
Note Submitter: alex dot pleiades at gmail dot com
----
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);