Where/how do I upload my php to force an mp3 download?

Status
Not open for further replies.

floaters

New Member
Messages
22
Reaction score
0
Points
1
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.
 

Derek

Community Support Force
Community Support
Messages
12,882
Reaction score
186
Points
63
File size limit is 10MB, any files larger will get deleted, try using google drive or some other service to host the files for download..
 
Status
Not open for further replies.
Top