$_SERVER['DOCUMENT_ROOT'] Not working?

Ive been struggling for a while with this

Mainly on my upload script did i discover this issue as nothing was uploading.
Now I know because it was trying to upload to a none existent folder

So heres my script
[php]<?php
include_once (“header.inc.php”);
?>
Homepage[/php]

heres the page

http://www.staff.spardel.com/testpage.php (Note this is a subdomain)

Heres where it then send you to

http://www.staff.spardel.com/home/users/web/b2027/moo.lutarinet/Spardel/staff

Why does it do this?

I am still learning PHP so can you please explain to me why it is doing it and how I go about fixing it?

Thanks

Edit:
My upload script, is coded to upload files to spardel.com/images/
and was trying to upload to staff.spardel.com/images/
[php] $dest = $_SERVER[‘DOCUMENT_ROOT’].’/images/’.$filedunder.’/’.$insert_id.‘img.png’;[/php]

If I was to put something like

[php]$_SERVER[‘DOCUMENT_ROOT’] = “/home/users/web/b2027/moo.lutarinet/Spardel/”;[/php]

Would it then work?


Tried this and got

http://www.staff.spardel.com/home/users/web/b2027/moo.lutarinet/Spardel/

How do I stop it from going from Staff.spardel.com?

What is your question?

How do you stop it from going to a subdomain?
You would have to stop using the $_SERVER operator

$_SERVER example
[php]<?php
echo $_SERVER[‘SERVER_NAME’];
?>[/php]
The above example will output something similar to:
www.example.com

If you question is how do you get a file from a form to a folder well thats more like this…
[php]
move_uploaded_file($_FILES[“file”][“tmp_name”], “upload/”.$_FILES[“file”]);
[/php]

If these do not help please read what you wrote and ask your question again because it is not very clear what you are asking.

Sponsor our Newsletter | Privacy Policy | Terms of Service