Best Method of Accessing Files From Home Directory

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 87
Joined: Wed May 16, 2012 4:17 pm

Tue Oct 16, 2012 7:02 pm

I am storing all my files which contains sensitive information on my sites home directory.

the way I access it is via code below

[php]$path = dirname($_SERVER['DOCUMENT_ROOT']).DIRECTORY_SEPARATOR.'folderiwanttoaccess'.DIRECTORY_SEPARATOR.'fileiwantoaccess.php';[/php]

I am using this approach so it is a bit portable, not path dependent

I just want to ask if there is a better way to do it, like a recommended way or best practice

Thank you in advance

Post Reply