From what I understand of web hosting, that is not the way it works at all. Depending on what server you're using and what the server settings are, localhost is actually pointing to a specific folder on your system. You can only access files located within that folder.
I could be wrong, but since no one else had replied and that is how I understand it, I thought I would throw that out there.
You can do things with PHP using include_path to be able to access files outside. And with Apache, you can do things like Aliasing (see
Mapping URLs to Filesystem Locations[
^]) and I assume you can do the same with other servers. But, you have to tell the server those types of things. Otherwise, any person could type what you wanted to and create all kinds of havoc.