Log in

View Full Version : script and help wanted for "forced-download of mp3"



inexperienced web builder
09-15-2008, 01:21 AM
I want to force a download of an mp3 file from my website. The file is 26 mins and there is already sound playing in the background of the page where I want to the link to be, therefore I really need the mp3 in question to be downloaded rather than played when people click the link. How do I force my site (or the browser) to download the mp3 rather than playing it?

To build my site I am using WebPlusX2 by Serif but this software seems unable to create the option for downloading an mp3 when visitors to my site click a link. I am inexperienced with code and script. I only know a few things in html code such as <b> bold </b> makes things 'bold'. I know nothing about PHP but it seems that I need to use PHP to complete my task. My limited research into this matter indictaes PHP can be usful to acheive my goal. I also have ExpressionWeb software and this will allow me to create a PHP file. I believe the PHP file goes on the server where my site is but I don't know how I connect my web-page to the PHP script, perhaps a simple link will suffice? I also believe there are security issues with having a forcedownload PHP script on my server which enables a mp3 file to automatically donwload. Obviously I would not want to do anything to comprmise the security of my site. How secure is this thing I want to do? IS there a safe script for my task?

Please can someone advise me where I can obtain the correct *safe* script that will make a link to my mp3 file downlaod rather than play. I do not want the mp3 to play when visitors click the link. I want it to donwlaod.

Phew! Hope that's clear and I hope someone can help.

:confused:

Master_script_maker
09-15-2008, 02:38 AM
the only true way to force a download is to zip it. you could also trick the browser by sending the wrong header but that doesn't always work. the other way is to tell users to right click save as.