How to prevent downloading of MP3 file in PHP? [duplicate]

How can I prevent downloading the MP3 file?

You can’t.

You can’t send someone data in a way that they can’t receive the data. If they can play it, they can download it. It’s the same action.

At best, you can digitally watermark your media with unique identifiers so that if someone re-shares the content, you can trace it back. You can also prevent someone from sharing a link to media by using signed URLs or otherwise one-time-use (or time-limited) URLs.

Leave a Comment