finding local path on server

L

ll

I'm trying to see if there is a way to determine the 'local path' on a
server (as opposed to the url path) via application, etc?

For example:

$parent_url = "http://www.testsite.org/upload/";
$parent_dir = "c:\\public_html\\upload\\";



Thanks,
Louis
 
J

Jonathan N. Little

ll said:
I'm trying to see if there is a way to determine the 'local path' on a
server (as opposed to the url path) via application, etc?

For example:

$parent_url = "http://www.testsite.org/upload/";
$parent_dir = "c:\\public_html\\upload\\";

Well it looks like possibly PHP?

then

$me = $_SERVER['SCRIPT_FILENAME'];

will have the path with the script file name that you can remove.

or it might be Perl:

my $me = $ENV{'SCRIPT_NAME'};
 
L

ll

ll said:
I'm trying to see if there is a way to determine the 'local path' on a
server (as opposed to the url path) via application, etc?
For example:
$parent_url = "http://www.testsite.org/upload/";
$parent_dir = "c:\\public_html\\upload\\";

Well it looks like possibly PHP?

then

$me = $_SERVER['SCRIPT_FILENAME'];

will have the path with the script file name that you can remove.

or it might be Perl:

my $me = $ENV{'SCRIPT_NAME'};


Thanks Jonathan,
The page prints the file directory - is there a way to get the
complete directory?

Thanks
Louis
 
L

ll

Well it looks like possibly PHP?

$me = $_SERVER['SCRIPT_FILENAME'];
will have the path with the script file name that you can remove.
or it might be Perl:
my $me = $ENV{'SCRIPT_NAME'};

Thanks Jonathan,
The page prints the file directory - is there a way to get the
complete directory?

Thanks
Louis



Thanks - I put this script that prints several keys. Is there
actually a way to discern what drive the directory is on (on the web
server)?

Louis
-------------

#!/usr/bin/perl

print "Content-type:text/html\n\n";
print <<EndOfHTML;
<html><head><title>Print Environment</title></head>
<body>
EndOfHTML

foreach $key (sort(keys %ENV)) {
print "$key = $ENV{$key}<br>\n";
}

print "</body></html>";
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top