File upload w/ dynamic path + Win XP SP2

Ok, I lost my previous post so I?m writing again, I was trying to upload file using Example scripts and obliviously I got permission error, because I?m using Win XP as host. Ok I went and add permissions to temp_folder , it supposed to work but I have SP2 installed and that one was blocking me from moving file so I have to add Modify permission for IUSER in my permanent upload directory? Any was that is just a comment of SP2

The question is what is the name of environmental variable that reruns patch to my website? (in my case should be ?c:/interbub/wwwroot/eShot/?

Thanks!

Huh?

:-?

If you want to know what environemental variables are set, you can do the following:
Click Start, click Control Panel, and then double-click System. On the Advanced tab, then click Environment Variables. There is your list. Find the one you are looking for.

Good luck.

yes those are machine based (+ Windows)

I’m talking about PHP vard such as $_SERVER, $PHP_SELF but for www root,
I searched them in PHP_INFO(); but it’s not there!

http://us2.php.net/variables.predefined

The www root is defined in $_SERVER[‘DOCUMENT_ROOT’]

It is not determined by the PHP.INI it’s dertermined by the webserver software. I use Apache and it’s in the httpd.conf file.

EDIT: I just checked my PHPINFO() and it showed up as an Apache Environment Variable.

Well the problem is that I don’t have this variable…
If I try to use it I’ll get:

Notice: Undefined index: DOCUMENT_ROOT in c:inetpubwwwrooteShoploc.php on line 2

Yes, I’m running XP/IIS for development and FreeBSD/Apache for hosting

So, how to I supposed to develop universal app?

PS: I had that variable somewhere that works on all platforms, but I lost my script and dont remember the name…

I don’t know for sure, but it looks like the $_SERVER[‘PATH_TRANSLATED’] can be used to find the document root.

I don’t see that variable in my list when I check my webserver (on Apache). Likewise, I don’t get a DOCUMENT_ROOT on IIS either.

The translated path gives you the entire local path to the script (after the server has done any virtual-to-real mapping). Perhaps that could be useful to you.

THis returns me:

c:\inetpub\wwwroot\eShop\loc.php

Including the name of the curent exec file… that is not good for me unles I cut the name of the file an leave only the path

Also if I’ll play with triming I would probably use other rariable that will return same thing but with single slash rather then with double

But, there was a var that gives the path right a way on all platforms with out any problems…

Well I’ll tell you what I do. I have a “GLOBALS” file :
[php]<?
echo ‘

$_POST
’;
while(list($Index, $content)= each($_POST)) echo $Index." - “.$content.”
";

echo ‘

$_SERVER
’;
while(list($Index, $content)= each($_SERVER)) echo $Index." - “.$content.”
";

echo ‘

$_REQUEST
’;
while(list($Index, $content)= each($_REQUEST)) echo $Index." - “.$content.”
";

echo ‘

$_ENV
’;
while(list($Index, $content)= each($_ENV)) echo $Index." - “.$content.”
";

echo ‘

$_SESSION
’;
while(list($Index, $content)= each($_SESSION)) echo $Index." - “.$content.”
";

echo ‘

$_FILES
’;
while(list($Index, $content)= each($_FILES[userfile])) echo $Index." - “.$content.”
";

echo ‘

$_COOKIE
’;
while(list($Index, $content)= each($_COOKIE)) echo $Index." - “.$content.”
";

?>
[/php]

I run this and it spit’s out all the global variables available to PHP. I cannot find the one you are looking for.

As I checked on php.net I found out this:

So I am thinking that maybe your variable you are looking for is a Function that checks the available globals and uses what it can.

You mentioned that you would have to strip off the script name off of the PATH_TRANSLATED Variable. Well all you would have to do is use the PHP_SELF which identifies the script, relative to the document root.

I know it’s not what you are looking for, but I don’t know what else to tell you on the subject. Document Root is something that is a Webserver thing so perhaps you need to check an IIS (or Microsoft) newsgroup/forum to see if there is a way to get IIS to send that info.

as for the double slashes… That’s a windows. Because windows uses the back slash as opposed to the unix/linux forward slash, they have to “Escaped” thus the double backslash.

Resolving this is as simple as using the stripslashes function http://us4.php.net/stripslashes

Ok,
Then I’llwrite a script and post it here for tuning up…

Sponsor our Newsletter | Privacy Policy | Terms of Service