How to acees the image folder outside root directory ?

Discussions of secure PHP coding. Security in software is important, so don't be afraid to ask. And when answering: be anal. Nitpick. No security vulnerability is too small.

Moderator: General Moderators

Post Reply
vijeee
Forum Newbie
Posts: 1
Joined: Wed Mar 26, 2008 5:04 am

How to acees the image folder outside root directory ?

Post by vijeee »

How to acees the image folder outside root directory ?

I search google,yahoo

I given path like /home/chandama/images/ to upload it uploaded the file

But the path is not working for displaying the image

I also tested with ./home/chandama/images/ path

How can I give the path.

Need to change cofig file ?

Please help me
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: How to acees the image folder outside root directory ?

Post by John Cartwright »

Use an intermediary script to serve the image,

Code: Select all

<img src="/image.php?image=foo.jpg">
this image.php should send the correct image headers using header() (take a look at the docs), then readfile() to read the actual file

of course the filename in this case will be readable through $_GET['image']
Post Reply