Jump to content


CHMOD Folders

  • Please log in to reply
1 reply to this topic

#1 cssmatt

  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 30 March 2006 - 04:14 PM

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?

#2 ober

  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 30 March 2006 - 04:46 PM

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.

Info: PHP Manual

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users