I'd like to get the correct php code to display filepath to a folder on my server. Currently I put the actual filepath in my script which looks like this: /home/username/mydomain.com/dir/upload/
So the script is installed in a subfolder "dir", and I need the path to the "upload" folder
I used this, but it doesn't seem to work, because it seems to put uploaded files into the root:
$_SERVER["DOCUMENT_ROOT"] . '/upload'
There is a
__DIR__ constant which will contain the script file's directory path.
So to get your upload path you could do:
echo __DIR__ . '/upload/';
For PHP < 5.3 you can do
See http://www.php.net/manual/en/language.constants.predefined.php for other 'Magic Constants'