I have a script that downloads an mp3 file off my server. If I throw
the code inline in to a PHP file and run it, the mp3 file downloads
just fine and plays happily in iTunes, WMP, etc. If I take that same
code, and put it in a function in my controller, the code executes and
downloads the mp3 file just fine. But, it will not play in iTunes,
WMP, etc.
The error I get tells me that the file is a different type than the
extension, even though if I view the file info on the file all the
info is for an MP3 file, the ID3 tags are there, etc. Everything
looks normal.
For reference, here is the code I'm using, inline in the PHP script
and inside of a CAKE controller function...
$file = '/path/to/mp3/file/12345.mp3';
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0,
private");
header("Cache-Control: private",false);
header("Content-type: audio/mpeg;");
header("Content-Length: "[EMAIL PROTECTED]($file));
header("Content-Disposition: attachment; filename=\"test
file.mp3\"");
header("Content-Transfer-Encoding: binary");
readfile($file);
No, I am not rendering the view for the CAKE function, so that's not
the problem. I'm wondering if the CAKE framework is adding extra
bytes to the MP3 files before it gets to the output buffer? Should I
try putting all those header declarations in the view for my
controller action and see if that works?
Any ideas would be greatly appreciated.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---