test.php code:
$fileloc = 'audio.mp3';
header('Content-type: audio/mpeg');
header("Content-disposition: inline; filename=$filename");
header('Content-Length:'.filesize($fileloc));
readfile($fileloc);
html code:
<iframe src="test.php"></iframe>
here is the updated code that is working.
thanks hafichuk
if anyone knows a way to do this with
<embed> or <object> rather than <iframe>
please share your code or send me a link.
Try changing your content type to
audio/mpeg3.Update 1:
Since it’s downloading the file as an attachment, you could also try changing the content-disposition to
header('Content-Disposition: inline; filename=audio.mp3');The reference I found for this was for
swffiles in the embed tag, however I would imagine that you should do the same.