Writing code for downloading MP3 files
I maintain a website that contains audio files that users can listen to simply buy clicking on a built in audio player on the website. However, I'd like to give the users the option of downloading a copy of the mp3 file to their computer so they can listen to it offline.
How do I write the code so that when the user clicks on the link I provided, it will prompt them to do that. I can't just do <a href="MP3file.mp3">MP3 file</a>, because that will just open the file and these are rather large files (15-20MB), so that would take a while to load.
What languages do you have available? What kind of a server is it, Apache Windows?
I saw another webhosting site that had ?action=save at the end of the url but that didn't work for me. I suspect that was not html.
edited to add that I am hosting on Yahoo small business but have access to several html editors and notepad.
a server-side language is required to send the header:
this forces the browser to download it the file.
or you can edit the config files of the server, and define that header as the default for that filetype.
Could you accomplish this with PHP? If so, how would that be done?
Eye for Video
Originally Posted by toenailsin
I don't have access to the server side. is there a code that can be placed individually on the anchor? either in css, JS, or html? I don't know PHP yet.
If you don't have access to the server, your best bet would be to just put a note for them to right-click, etc. to download the file.
I did that for the time being. Maybe I'm not saying it right because I don't exactly know what "having access to the server" means but I did notice when I was having my files hosted on MediaMax that under the hosting side the url had a " ?action=save" code at the end.
Originally Posted by LeeU
Is that something I can do?
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)