Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How do I make an MP3 file downloadable?

Featured Replies

Hey,

 

I have created a website and on one of the pages you can listen to music my friends have made. I want to make these tracks downloadable.

 

How do I make mp3 files downloadable?

 

Cheers

make a file called dl.php

<?php
$filename = 'path/to/downloads/'.abs(intval($_GET['file'])).'.mp3';
if (file_exists($filename)) {
header("Content-Length: ".filesize($filename));
header('Content-Type: audio/mp3');
header('Content-Disposition: attachment; filename=audiofile.mp3');
readfile($filename);
}
?>
then just name the files 1.mp3, 2.mp3 etc... or you can use a database to stoe the path/name etc ...

There is an easy way I think everybody can do, that is, you can compress the MP3 file to make it as a ZIP file and then upload the ZIP file to your server. When a user click the link for the ZIP file, the web browser will remind he or she whether to download the ZIP file or not. That's it.Hope it will be useful to you.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.