Forum Moderators: coopster

Message Too Old, No Replies

Filesystem, below web root

storing and retrieving

         

kkonline

7:21 am on Sep 15, 2007 (gmt 0)

10+ Year Member



In a web poll on top most programmers suggest to store Filesystem, below web root that means where it is not accessed by the web.

Now how do i store images below the webroot and and how to retrieve them for displaying? Please tell me the logic and sample code too if possible.

phparion

7:54 am on Sep 15, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



/home/username/public_html

could be your website directory.

/home/username/images/

could be your images directory

to link images this might work,

src='/home/username/images/image.gif'

But I am not sure if this will work you can give it a try you can also check few server variables like DOCUMENT_ROOT

btw why do you want to put images behind public_html or www directory?

you cant protect them with this if you have to show them in the browser.

kkonline

8:00 am on Sep 15, 2007 (gmt 0)

10+ Year Member



The aim is to store around a 1000 images and maybe ppt and videos using a better effective method which doesn't take too much server resources AND to have some sort of number of views and rating associated with each file like we have with articles etc...

Can't figure out how to store below document root or above document root or in database or use combination or what..

coopster

10:52 pm on Sep 16, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



The link to the images could be a php script that will read the image from the directory below the docroot and output the correct image header [php.net] and then the file itself, using readfile [php.net] or something similar.