Welcome Guest, Not a member yet? Register   Sign In
Pictures outside of the public_html directory
#1

[eluser]Unknown[/eluser]
How can I view the pictures in the CI outside the public_html directory
- galleries
- public_html

I write "../galleries/photo.jpg" and does not work.
#2

[eluser]Jelmer[/eluser]
Files outside the webroot can't be accessed through normal means, which is most often the reason to put things outside the webroot. If you want your images to be easily accessible you should put them in the public_html folder.

I've put documents outside the webroot to be able to secure them and only make them accessible when a user was logged in. Use readfile() for such purposes but don't forget to set the MIME type headers before you use the readfile function. Like this:
Code:
header('Content-Type: image/jpg');
readfile('../galleries/photo.jpg');
#3

[eluser]Unknown[/eluser]
Thanks!
Now it works well.




Theme © iAndrew 2016 - Forum software by © MyBB