Allow visitors to Download MP3 files

72 and retired. I recently used a software program called WebPlus X6 to design and publish a website. I am happy with how it came out but, there is one thing I can not do by using that software. I want to allow visitors to Download MP3s, imbedded in my site. Many of them are 45 to 90 minutes long so rather than play them through their browser, it would be better to download to a portable device of some kind. I know that you can right click and “Save target as” but if possible I would like to make it so they only have to click on a button that opens up a dialog saying, “Do you want to Open or Save this file.” I have searched all over the net for a simple way to do this. I have found several that will “force a download.” My problem is that I have practically no experience using code. All of the solutions I have found, use php code. My software has a way of inserting HTML into a page but, nothing happens when I try to insert the code I have found. I don’t know what do do with the code I copy or how to make it work with buttons on my site. I am pretty good with user friendly software but, can’t get a grasp of this code business. I would greatly appreciate any help or suggestions.

The simplist way would be to provide the user with a direct link to the file, put the link under the embed code, then all the user has to do is click on the link. unless the default action has been changed, it’ll automatically ask them what to do.

Hi Bob0141,

We should be able to help you out, but I have a couple of questions that will hopefully make things as easy as possible.

Do you know if your hosting plan includes PHP or ASP hosting? Chances are it does, but it would be good to find out for sure if you are having troubles getting scripts to run. PHP and ASP are very different creatures, but both essentially do the same thing. They let you write code (programs) that are run by the server. If you need to use ASP instead of PHP, I would look for a similar forum to this one for ASP specific advice.

If you are using windows, open up notepad. If you are on a mac, open up TextEdit. IMPORTANT - if you are using TextEdit, you will need to go to the format menu and choose “Make Plain Text.”

Type (or cut and paste) the following on the first line:[php]<?php echo 'SUCCESS! Bob0141 is the man!'; ?>[/php]DO NOT attempt to change any of the attributes like font, color, size, etc. Save the file as ‘phpTest.php’ You may be asked if you are sure you want to use ‘.php’ as the extension - you do.

Now you need to put this file on your server. Normally you would do this using a ftp program or using a file manager in your hosting control panel (cPanel, etc.) You may be able to upload the file using your WebPlus software, but in looking over the user’s guide, I do not see a direct reference to doing so. There is a section that refers to adding an html file.

One thing to note at this point: in order to run php code, it must be contained on a page that is saved as .php NOT .html . For instance, if you try to insert php code into your page: http://www.mydomain.com/index.html it will just show the code on the screen without trying to run it. You would need to put it in a file named index.php instead and you would run it by going to: http://www.insertyourdomainhere.com/index.php

Before going forward with anything else related to scripting, lets make sure we can run code and that you are familiar with the procedure for getting it onto your site. Lets try to run the script that you uploaded. Hopefully (for testing purposes only), the file was uploaded to the same directory that your index.html or similar landing page reside in (your “root” directory). You will need to figure out how to get to the file using the url. In the simplest of cases (inside the “root” directory, it would be at: http://www.insertyourdomainhere.com/phpTest.php

If it was uploaded to a directory named “uploads” you should try: http://www.insertyourdomainhere.com/uploads/phpTest.php . This assumes that the uploads directory is inside your “root” directory.


While this starts to address server scripting, you may be able to accomplish what you are looking for without the need for this.

As I understand it, you will be storing several mp3 files on your server and you would like to create “buttons” that people left-click on to produce a download dialog. You are familiar with the option of right clicking and choosing “save as…”; however, you are looking to more or less reproduce this action with a simpler left click. Please correct me if I am stating this incorrectly.

You referred to wanting a download button. Do you specifically want a button, or would a left-clickable link be alright?

If you are looking to not have the files play in the browser, you should compress them first. The easiest way to do this is to zip them. Please let me know if you need assistance in how to do this. By compressing the files, you accomplish two big things. First you might reduce the filesize, which will shorten the download length and your bandwidth usage. The second reason is that it makes sure that the browser won’t identify that the file is an mp3 and go ahead and play it or serve it to a player or plugin. This wouldn’t happen with the “save as…” right click; however, it means that left clicking on a link to the file will generate a download dialog. Depending on your desires regarding the concept of a button, this may be enough to solve your problem (with simple html links to the compressed files).

I know this is a lot to digest. Please look it over and let us know any questions that you have. Once we know a little more, we should be able to help you find a solution.

Sponsor our Newsletter | Privacy Policy | Terms of Service