Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP how to specify "back one directory level" in an url

Tags:

url

php

mysql

I have moved all of my files from being in the root (no folders, not very organised) so that they now reside within the following directory structure in my root folder:

css
images
js
scripts
index.html

... and this is fine. However, I have two or three php scripts which upload files (images) into the images folder above. This worked fine until I moved all of my files around and now I have been experimenting with things like "../" etc in order to link from the scripts directory, back one level, and then into the images directory.

Any help appreciated guys....

like image 958
Donal.Lynch.Msc Avatar asked Aug 26 '11 20:08

Donal.Lynch.Msc


1 Answers

Using what you stated above will work, so if you're in css and want to go to images (as an example) you would do the following:

require_once('../images/yourimg.png');
like image 146
Ashley Avatar answered Oct 20 '22 01:10

Ashley