Hello Everyone,
I am using the following to create a link on my site that will force an mp3 download without the end user having to right-click:
sound_file.php contains the following:
<?php
header("Content-disposition: attachment; filename=sound_file.mp3");
header("Content-type: audio/mpeg");
readfile("sound_file.mp3");
?>
index.htm contains the link:
<a href="sound_file.php">Download</a>
sound_file.mp3 is the file.
I have placed all 3 files, sound_file.php, index.htm, and sound_file.mp3 in a sub-directory. It seems to work but instead of downloading the 136 meg file, it offers one of 214 bytes. Can someone tell me what I'm missing, here?
Thank you for your time.
I am using the following to create a link on my site that will force an mp3 download without the end user having to right-click:
sound_file.php contains the following:
<?php
header("Content-disposition: attachment; filename=sound_file.mp3");
header("Content-type: audio/mpeg");
readfile("sound_file.mp3");
?>
index.htm contains the link:
<a href="sound_file.php">Download</a>
sound_file.mp3 is the file.
I have placed all 3 files, sound_file.php, index.htm, and sound_file.mp3 in a sub-directory. It seems to work but instead of downloading the 136 meg file, it offers one of 214 bytes. Can someone tell me what I'm missing, here?
Thank you for your time.