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!
A Question Regarding CHMOD Permissions
Moderator: General Moderators
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
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:
you would go with something like:
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.
Instead of accessing the file normally, like:
Code: Select all
<img src="protected/myimage.gif" />Code: Select all
<img src="fetch.php?path=protected/myimage.gif" />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?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:
you would go with something like:Code: Select all
<img src="protected/myimage.gif" />
CheersCode: Select all
<img src="fetch.php?path=protected/myimage.gif" />
Edit: I should note that you would need to perform a aothorization check on the file being fetched...otherwise it's no more secure.
Thank for your Help!
Eyal