David
David

Reputation: 4895

How can I securely put music on my website?

I mean, I want to share an audio file without letting users to download it.

Here are my tries :

Is it possible ? If so, how ?

Upvotes: 3

Views: 2343

Answers (3)

Metablocks Corp
Metablocks Corp

Reputation: 1645

It's possible using Amazon S3 (similar to the way Soundcloud does it) to generate secure mp3 links for use in your HTML5 player. You generate a secure mp3 on S3 that is valid for a very short time (seconds or minutes), there by prevent someone from copying and sharing the link. You will need to generate the link dynamically using SDK/API.

See example of how to use PHP to generate secure links.

Upvotes: 0

BrainDamage
BrainDamage

Reputation: 34

Add a .httacess function to block users from downloading files in a path or a whole entire folder. You can also make a password for files also so they wont be able to be deleted without a password

This goes in your .htacess file

RewriteEngine On
# you can add whatever extensions you want routed to your php script
RewriteCond %{REQUEST_URI} \.(mp3|wav|oss)$ [NC]
RewriteRule ^(.*)$ /download-file.php?filename=$1 [L]

The last RewriteRule change the download-file.php to your actually php or html file with the download.

Upvotes: 1

William Brendel
William Brendel

Reputation: 32189

The correct answer is that, if you allow your users to listen to the music, they will, by definition, be able to record said music. There is a very clear distinction between security, which you are requesting, and obfuscation, which you actually want.

Upvotes: 2

Related Questions