Jump to content


Images won't display


2 replies to this topic

#1 bfva

    Young Padawan

  • Members
  • Pip
  • 42 posts

Posted 15 January 2009 - 01:15 PM

Happy new year everyone

My questions is how do i access images stored outside the public_html folder?

i have tried doing <img src="/home/user/images/hello.jpg" /> but this didn't work as the image didn't load. I looked at the image URL in the browser and saw it was

http://www.mywebsite...mages/hello.jpg

I don't know why the image link became like that.

Thanks for your help

#2 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 15 January 2009 - 01:54 PM

The url ended up like that because browsers work from the document root, not the server root. It's a security thing.

In order to access files that reside outside of public_html, you need to create a script (i.e. PHP) to load and display the image for you. You also must be careful when doing this. If you're not, you could create a huge security hole.

#3 bfva

    Young Padawan

  • Members
  • Pip
  • 42 posts

Posted 16 January 2009 - 09:53 AM

Thanks for your help, i'll use an absolute url instead, to avoid creating a security hole lol





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users