In my site we are doing image protecting section. Can I protect images in my site from others without download.That is i want to protect my image from downloading by others.Is it possible using php code
Asked
Active
Viewed 1,834 times
-5
-
2Please search this site first you will get several posts on this. – Amit Ray May 19 '16 at 12:19
-
you can disable JavaScript to right-click. There is no good alternative solution: If you know the URL to the image, you can download it – SAUMYA May 19 '16 at 12:19
1 Answers
0
you can do this by using force download in php.
$file_url = 'base path to file / file name';
header('Content-Type: application/octet-stream');
header("Content-Transfer-Encoding: Binary");
header("Content-disposition: attachment; filename=\"" . basename($file_url) . "\"");
readfile($file_url);
this code will download the file and block files folder using htaccess
<IfModule authz_core_module>
Require all denied
</IfModule>
<IfModule !authz_core_module>
Deny from all
</IfModule>

quarksera
- 91
- 2