Jump to content

Recommended Posts

Im trying to protect a folder of images so that users cannot simply type in the URL and load the picture.

My site has a login script so that only users who have access can view the pictures. So i want to be able to load these pics onto a webpage for viewing, but i dont want the folder accessible?!

Is this possible, because ive tried quite a few chmod settings, and it seems that to view the image at all needs the Other setting to be 7 (execute). If i set it to anything else, the users cant access the folder dirst (which is what i want), but i cant view them through the webpage either!!

Any suggestions?
Link to comment
https://forums.phpfreaks.com/topic/6182-chmod-folders/
Share on other sites

One way to do it would be to copy the image to a temporary folder when someone requests it. Once the user loads the image into cache (presumably at the end of the page load), you fire off an AJAX call that removes the image from the temp folder. They don't see you do it, and your images are safe. The only problem is that they've cached the image at this point, and anyone with half a brain can rob the file out of the browser cache.

So really, the only way to protect images is to watermark them.
Link to comment
https://forums.phpfreaks.com/topic/6182-chmod-folders/#findComment-22337
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.