[RESOLVED] Force download of MP3 file instead of streaming
Hi, i had encountered problem with MP3 file links:
in IE/Safari/Chrome, when a link to a MP3 file is clicked, the download starts correctly; but in Firefox that doesn't happen - clicking the MP3 file link, it starts an unwanted streaming through a preinstalled FF media plugin.
If you are using PHP please use the [PHP] and [/PHP] forum tags for highlighting...
The same applies to HTML and the forums [HTML][/HTML] tags.
So, how is it possible to change a MIME attribute of an MP3 file?... The need is to leave the file with his original extension because the same file is managed by a web-mediaplayer, but i'd like to let a download by clicking a specified button.
I've to learn PHP and create a dynamic page which redirects to MP3 files (download.php?fileID=1)... At the moment, i have to admit it, have really no idea in how to build dynamic php code.
Are you sure that it has to be that complex?
You might want to at least give it a try.
Just create a simple PHP file from the code above. Name it
It is NOT a part of any Web page, it is a small separate file, it just needs to reside in the same folder as the mp3.
The <a> just needs to use that file as the href.
It's just a plain anchor... nothing special, no different than linking to any other web page or file.
Best of luck,
Eye for Video
@EyeForVideo - Sure, i'll give a try next days... the other thing to consider, is that there's not a single file, but i have to manage a lot of MP3 through a Database, so i have to make the php-content dynamic: the php page has to request an ID number, corresponding to a MP3 file in the DB... i'll study some php to do that (i think is a little different from asp/vbscript code).
the PHP part is just one simple file and can handle multiple files... here's an example: http://www.worldbarefootcenter.com/v...oad_video.html
Download links for a gazzillion video.
It's just an anchor... if you can create a dynamic anchor (forget about there being a link to the PHP file).. link to it just as if it where an image file.
the PHP part is just one simple file and can handle multiple files...
WONDERFUL, PHP mini-page works pefect!... I'm sorry, i didn't immediately understood that it meant to be a dynamic page, i thought "file" was only an example in php...
I only have to put it in any folder where MP3 files are placed (the files are album-ordered), but really this is not a problem because the php code is very short.
Well, finally i have to admit that PHP code has so many rich functions and i don't understand why other server-side languages (like ASP) cannot do the same things...
Are you saying that the download links I posted do not work in Safari?
The links all work just fine in Safari on my machine.
Or are you having problems when you implement that download php file?
<a href="direct_download.php?file=fineline.mp3">Download the mp3</a>
of course the href=" has to be the correct path. So if the web page with the link on it is one level up or down, the path has to reflect that.... but it will work just fine.
Also the file= name has to be changed to the name of the file you are downloading. If you put file=direct_download.php, then it will download that file. So recheck your link code.