Getting the full path of a file/folder

Username (e.g. epiz_XXX) or Website URL

epiz_30473031, dev.bildix.cf

Error Message

500 internal service error

Other Information

Hello, I’m currently working on a website and something I’m setting up requires the full path for a file. Entering /dev.bildix.cf/htdocs/[filename] (which is where the file is) doesn’t work and gives a 500 internal service error. Is there any way to get the actual file path?

Use this php code to get directory path:

<?php
echo getcwd();
?>
1 Like

Thank you! By the way, is there any other way to find the path without using a PHP file?

I don’t really know. In fact, I found that code after googling :sweat_smile:

In JavaScript, you can use window.location.pathname.

1 Like

Wait, why do you need to full path? Also, PHP will return the path from the location of where PHP is installed, and it is not installed in the root, so it will not return the full path anyway.

You also do not have root access on the server, so a full path is not allowed to be used here.

The 500 error is because that path does not exists. A file with the URL of “https://mydomain.com/folder/file.php” has a full path of “/folder/file.php”, you should NEVER include the root directory (htdocs) to get a files path here (Or really anywhere), it will never work.

If you type “/dev.bildix.cf/htdocs/[filename]” for the file path, it is searching for “http://yourdomain.com/dev.bildix.cf/htdocs/[filename]” witch clearly does not exist. Use “/[filename]” instead.

4 Likes

File paths can only be checked on the server, which is what only PHP code can do. You can’t see server paths from the browser (thankfully), and there is no legitimate reason anyone would ever need to.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.