viral4ever
viral4ever

Reputation: 285

php out of root directory public_html

I want to know something about php. I want to make a folder out of root directory and want to access that folder in php. currently i am using xampp to make website, so my root folder path is "C:\xampp\htdocs"

now i want to make a folder out of root directory, like "C:\xampp\users"

so whatever i upload my data, that will be saved on that folder, same as on server. On my linux server, my root directory is "user_xyz/home/public_html" and i want to create a folder in "user_xyz/home/users" which is not directly accessible via url. this feature is used in ELGG social networking script. I am not able to understand their codes so i am asking here. i think that this is best option so secure website, so if anyone will be able to upload shell or harmful script on my server, will not be able to access it directly.

for example, if i create user data folder in root directory and hacker will be able to upload a harmful script, it will look like "site.com/users/pics/shell.php" to access that file. but by using that technique, hacker wont be able to access that shell directly as "users" folder is not in my root directory. all i know about elgg's system is that they are using masked url to get that picture from that folder and they save that folder link in databse. like "site.com/picture/askjahsf3215" for my profile picture.

so i want to do same for my website. so if anyone knows that, let me know. :D

Upvotes: 1

Views: 548

Answers (1)

user3026568
user3026568

Reputation:

You can ise expolede() to get your directory in array then use it. Or you can use CDN or subdomain.site.com as your CDN for image.

Upvotes: 2

Related Questions