Page 1 of 1

A Question Regarding CHMOD Permissions

Posted: Sat Feb 10, 2007 5:58 pm
by eyal
I've got a folder called "private_photos".
I don't want to allow users to view the content of that folder (By Simply Typing: "www.domain.com/private_photos/"), But Sometimes I want to show a photo from that folder in my webpage.

How can I set the CHMOD in a way that No one can just view the content of the folder, but still show a specific photo from that folder on my site?

Of course the names of the photos are encrypted so no one can just guess the name of the photo.

Thanks once again!

Posted: Sat Feb 10, 2007 6:49 pm
by alex.barylski
use a "fetch" script that pulls the selected file from a protected directory either via .htaccess or storing it outside of the document root...

Instead of accessing the file normally, like:

Code: Select all

<img src="protected/myimage.gif" />
you would go with something like:

Code: Select all

<img src="fetch.php?path=protected/myimage.gif" />
Cheers :)

Edit: I should note that you would need to perform a aothorization check on the file being fetched...otherwise it's no more secure.

Posted: Sat Feb 24, 2007 6:54 am
by eyal
Should I write any code inside the fetch.php file?

Posted: Sun Feb 25, 2007 9:12 pm
by eyal
Hockey wrote:use a "fetch" script that pulls the selected file from a protected directory either via .htaccess or storing it outside of the document root...

Instead of accessing the file normally, like:

Code: Select all

<img src="protected/myimage.gif" />
you would go with something like:

Code: Select all

<img src="fetch.php?path=protected/myimage.gif" />
Cheers :)

Edit: I should note that you would need to perform a aothorization check on the file being fetched...otherwise it's no more secure.
Would you mind to explain to me what code should I write in the fetch.php page?

Thank for your Help!

Eyal