Welcome Guest, Not a member yet? Register   Sign In
Avoid direct-linking to images
#1

[eluser]veledrom[/eluser]
Hi,

Code:
$file_content = file_get_contents('web/docs/hello.pdf');
$new_file_name = 'hello.pdf';
force_download($new_file_name, $file_content);

If anyone knew this part 'web/docs/hello.pdf', they would have direct access to it but thank to force_download() which helps us to avoid direct-linkers.

Now, I want to display pictures on my site and want to avoid direct-linking. Is there any particular way of doing it CI?

'web/img/image.png' part shouldn't be visible to anyone if they check source code in browsers.

I have this as my htaccess in root:
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|web|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

Thanks


Messages In This Thread
Avoid direct-linking to images - by El Forum - 05-24-2012, 06:17 AM
Avoid direct-linking to images - by El Forum - 05-24-2012, 06:46 AM
Avoid direct-linking to images - by El Forum - 05-24-2012, 01:41 PM
Avoid direct-linking to images - by El Forum - 05-26-2012, 12:08 PM
Avoid direct-linking to images - by El Forum - 05-26-2012, 12:46 PM
Avoid direct-linking to images - by El Forum - 05-27-2012, 01:51 AM
Avoid direct-linking to images - by El Forum - 05-28-2012, 08:10 AM
Avoid direct-linking to images - by El Forum - 05-30-2012, 01:31 AM



Theme © iAndrew 2016 - Forum software by © MyBB