PHP Streaming MP3

后端 未结 7 732
情深已故
情深已故 2020-12-02 19:12

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

7条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-02 19:56

    Applying all these solutions, which are valid to hide the original path and filename, unfortunately doesn't prevent from unauthorized download. Indeed the client (on my case: Chrome) downloads the file.

    Here the lines I put on my server:

    
    

    with or without the line

        header("Content-Transfer-Encoding: binary"); 
    

    the final result doesn't change The directory /mp3 is located into

    /home/myuser/
    

    (thus /home/myuser/mp3) and the public HTML directory is

    /home/myuser/public_html
    

    thus calling my domain and giving

    /player.php?file=music.mp3
    

    it downloads a file called music.mp3 with all the original content.

提交回复
热议问题