PHP upload image to one directory from multiple pages

soynemesis

New Member
I have a script that is uploading images to my site, it works locally (haven't even tested it on the web server yet) but the problem is that I can't figure out how to get it to upload the images to a central location no matter where the script is run from.For example my site structure looks like this:\[code\]/ROOT/ /IMAGES/ /USER/ upload.php /IMAGES/ /ADS/ upload.php /IMAGES/ /COUPONS/ upload.php /IMAGES/\[/code\]Right now the different upload.php files inherit from another php file that has the uploading script.Inside the script the line that sets the upload path looks like this \[code\]$newname = "images/".$image_name;\[/code\].That line is why I have an "images" directory under User and one under ADs and one under Coupons. What I want is to be able to have my script upload all images to the /IMAGES/ directory under the /ROOT/ directory, but I can only figure out how to make the path go up levels (using "../") rather than start at the root and go down. How can I get it to always upload to the /ROOT/IMAGES/ directory?
 
Top