• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1749
  • Last Modified:

How Do I go One Folder up in HTML

Hello EE Gurus ...
I have a folder called scripts  that is one level up than my domainname.com (Where all of my pages are) folder.
However, I can not access the script folder from the <script> {or from the <img src=".."> tag.

The code I am using is as follows:
   <script type="text/javascript" src="../scripts/validateRegForm.js"></script>
I have used every possible combination I can think of (Forward slash, backward slash, using ./ instead of ../).

When I try to go up one level in image tag, the image does not show up. However, the strange thing is that when I right click the image (what ever is being displayed instead of the image), and go to properties, the URL is always www.mydomain.com/images/image.gif.

This is an urgent request and would appreciate if this is resolved as quickly as possible.

Thanks
<<< Ali >>>
 
0
MohammadAliQureshi
Asked:
MohammadAliQureshi
1 Solution
 
Ryan ChongCommented:
alternatively, use:

<script type="text/javascript" src="/scripts/validateRegForm.js"></script>

<img src="/images/whatever....">

?
0
 
MohammadAliQureshiAuthor Commented:
@ryancys:: Will the code you suggest assumes that the scripts folders are under the domain.com (WWW)folder?

Hwever, I want all of my scripts out of the WWW directory (In this way the scripts will not be accessible via www.domain.com/scripts).

Thanks,
<<< Ali >>>
0
 
Ryan ChongCommented:
so where your "scripts" folder located at?

>>In this way the scripts will not be accessible via www.domain.com/scripts

is your scripts are in javascript or server side scripting? if your scripts are in javascript, you can't prevent public internet user to access it, because it's client side technology, which downloaded to client end to run.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
MohammadAliQureshiAuthor Commented:
@ryancys::

My scripts are in root folder instead of WWW folder. Here is how my folder structure looks like:

ROOT
|
DomainName.com (This is where my page is).

What I want is this

   ROOT  
_____|__________
|                                 |
scripts                  DomainName.com (Pages resides here)  
My page is a combination of Javascript and PHP (BTW PHP include and require works fine!. It is the HTML part that does not work).
To avoid that someone use the following URL to access my scripts:
http://www.domainname.com/scripts
I want to put them in the ROOT Directory instead of WWW directory.
Hope this helps....
Thanks
<<< Ali >>>
0
 
Ryan ChongCommented:
>>To avoid that someone use the following URL to access my scripts

if you try to avoid someone to access your scripts, but you want to "use" it on your website, I can tell you it's impossible.

However, you still can put the scripts folder in www, before that, may I know what web server you're using to host php? IIS or Apache HTTP server?

0
 
MohammadAliQureshiAuthor Commented:
@ryancys:

I believe my host uses Apache servers ...

Why the location has to be WWW directory?

Thanks,
<<< Ali >>>
0
 
CraybeCommented:
I came across this problem recently and it is my understanding after much investigation that on an Apache server it is possible to do this to a very small degree but only for retrieving variables.

The limitation appears that you can do a php include to retrieve hidden variables such as database user
& passwords eg. <?php include("../vars/hiddenvars.php"); ?>   but you won't be able to do much more than that, I'm certain that will include scripts.  The problem is that if you have a relative link in the php file you have included to a directory above the root it will always be run as being inside the root domain.

If you are trying to run the script above the root for security reasons, such as it contains passwords or sensitive data in variables, your best bet would be to strip them out of the script and retrieve them using a php include (or perhaps a java equivalent), then call the script that will use the variables you just imported at run time.

Hope this gets you on the right path.
0
 
MohammadAliQureshiAuthor Commented:
Hello:

After lots of tries, I found out that What I am trying to accomplish is almost not possible ....

So, I am givving up on this .... The work around I am trying is to use permissions. Hopefully this will work ...

Thanks,
<<< Ali >>>
0
 
manavsiCommented:
ali,
I got whats ur point.. u cant do that, because, on WWW, you cannot access folder outside ur Domainname.com
So, its practically not possible, put ur scripts folder inside it and try to access it as...

/scripts
./scripts

above 2 will work fine.. :)

HTH
Manavsi
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now