Jump to content

file permissions


birbal

Recommended Posts

1) what should be the file permission for my php function library file?...where the file can be included into any file and can be excuted...but user cant access or viw or download it...please any give me some info about file permissions...2) what should be the folder permission (for image) where i can use <img> tag for use...but user wont be able to download that3) if i put any folder outside of public_html and use absolute address (not URL) will it be safer?

Link to comment
Share on other sites

1) what should be the file permission for my php function library file?...where the file can be included into any file and can be excuted...but user cant access or viw or download it...please any give me some info about file permissions...
You can put all of those files outside of the web root, or you can use the server's access restrictions to deny public access to a certain directory or file.
2) what should be the folder permission (for image) where i can use <img> tag for use...but user wont be able to download that
You can't do that. When the browser loads the image tag it downloads the image. You can't allow them to download the image and also stop them from downloading it.
3) if i put any folder outside of public_html and use absolute address (not URL) will it be safer?
I'm not sure what you're referring to, anything outside of the web root cannot be access directly online.
Link to comment
Share on other sites

1)You can put all of those files outside of the web root, or you can use the server's access restrictions to deny public access to a certain directory or file.2)You can't do that. When the browser loads the image tag it downloads the image. You can't allow them to download the image and also stop them from downloading it.3)I'm not sure what you're referring to, anything outside of the web root cannot be access directly online.
1) if i put include file out of web root how will i refer to that file?...include "______" ?????2) no ..i mean that when user load a pages he will show the image...but if user try to download the image file by the url...is there any way to stop it? eg <img src="http://something.com/img/image.jpg" /> here image will be shown in the page..but is there any way to stop downloading the file by accessinghttp://something.com/img/image.jpg3) it got my answerd in (1)..thank you!
Link to comment
Share on other sites

For 2, there is no way to do it. When a browser downloads an image as part of a page, it uses the exact same request that it uses when you try to get an image directly in the URL bar. The server cannot tell the difference, so it serves the image in both cases. These are the rules of HTTP.

Link to comment
Share on other sites

1) if i put include file out of web root how will i refer to that file?...
It depends how the directory structure is set up, but the normal rules apply. You can use ".." to go up a level, etc. If you pass include a relative path it does not start at the web root, it starts at the directory where the PHP script is, wherever that is. So, it doesn't matter if the file is under the web root or not. You can always just give it an absolute path and start at the filesystem root.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...