How to prevent downloading images and video files

2019-01-02 16:05发布

How to prevent downloading images and video files from my website? Is it possible? What would be the best way to do this?

24条回答
步步皆殇っ
2楼-- · 2019-01-02 16:16

No it's not. You may block right-clicks and simillar stuff but if someone wants to download it, he will do so, trust me ;)

查看更多
余生请多指教
3楼-- · 2019-01-02 16:16

I think the best way is: STREAM THE VIDEO IN SEPARATED ENCRYPTED PARTS.

There are video hosting services such as vzaar that have this functionality. As far as I know, that will make it really hard to download directly. At least for 95% of the people.

But of course, if the video plays on the screen people can just use a screen recorder and some simple software to record sound from the audio output (but he/she will have to play the ENTIRE thing to save it, totally inconvenient).

查看更多
ら面具成の殇う
4楼-- · 2019-01-02 16:17

This is how I do it in case anyone in the future is wondering.

I put this in the .htaccess file on the root server:

RewriteEngine on 
RewriteCond %{HTTP_REFERER} !^http://(www\.)?domain.com/ [NC] 
RewriteCond %{HTTP_REFERER} !^http://(www\.)?domain.com.*$ [NC]
RewriteRule \.(mp4|avi)$ - [F]

This stops them from say going to domain.com/videos/myVid.mp4 and then saving it from there.

查看更多
谁念西风独自凉
5楼-- · 2019-01-02 16:17

I think the best way is to prevent right clicking on your webpage, because that is the most convenient way a normal user try to download the content, and you can consider it as remark if u able to do this only as you are never gonna be able to stop a computer geek or hacker people from downloading it, because once the content is on the internet, it means it is in the public domain already...

查看更多
深知你不懂我心
6楼-- · 2019-01-02 16:19

If you are using PHP, the best way is to control it the .htaccess, you need to put your files, images and videos under consideration in a separate folder/directory, and create a new .htaccess file in this directory with the below:

RewriteEngine On
RewriteCond %{REQUEST_URI} \.(mp4|mp3|avi)$ [NC]
RewriteCond %{HTTP_REFERER} !^http://sample.com/.*$ [NC]
RewriteRule ^.* - [F,L]

The first line %{REQUEST_URI} will prevent getting the file through the web browser, or through curl. The second line %{HTTP_REFERER} will prevent accessing the imahe/video using HTML tags <img> or <video> from any website except the exception ! you provide instead of http://sample.com/ which usually should be your website itself.

You can also have a look at my question and the accepted answer here for more tricks in the browser side.

查看更多
明月照影归
7楼-- · 2019-01-02 16:19

As soon as they view your page that includes the picture or video, the item is downloaded into the temporary folder of their browser. So if you don't want it downloaded, don't post it.

查看更多
登录 后发表回答