I have a very similar situation to the person who asked: Can I serve MP3 files with PHP? Basically I am trying to protect mp3 files from direct download, so users have to go
Two things stand out:
Content-Length
set. If you server is set to automatically gzip your output, this can mess with things. Try turning off Content-Length
and see if that fixes it.Content-Type
s set. Since it's Mp3 that you're serving, just use audio/mpeg
. You can effectively get rid of the whole last header()
command. It's easy to get carried away with HTTP headers.Try it out and let us know how it goes!