Images in higher level directory

I

Iain

Hi All

I want to store various objects at a level higher than wwwroot.

Is this possible
I have the following test html program

<html>
<head>
</head>
<body>
<img src = "..//Images//testimage.jpg" width = "300" height =
"300"/>
</body>
</html>

and the image is not displayed although the proerties of the image
appear to be correct
ie they point to the correct directory

Thanks in advance for any help offered

Iain
 
D

Dylan Parry

Iain said:
I want to store various objects at a level higher than wwwroot.

Any file stored higher than the root will not be visible (or indeed
usable) to the public. The only way to get around this is to write a
script to dynamically write the contents of these files to a stream that
can be accessed from the public side.

--
Dylan Parry
http://electricfreedom.org | http://webpageworkshop.co.uk

Programming, n: A pastime similar to banging one's head
against a wall, but with fewer opportunities for reward.
 
D

David Dorward

Iain said:
I want to store various objects at a level higher than wwwroot.

If the file is in a directory higher then the web root, then it can't be
accessed directly. Relative URLs are converted to absolute URLs, and ".."s
start to be ignored once you reach the webroot.
 
A

Andy Dingley

Iain said:
I want to store various objects at a level higher than wwwroot.

Then a secure web server should make damn well sure they can't be
accessed from there.

(read the docs and discussion on web server config and security issues)
 
H

Harlan Messinger

Iain said:
Hi All

I want to store various objects at a level higher than wwwroot.

Is this possible
I have the following test html program

<html>
<head>
</head>
<body>
<img src = "..//Images//testimage.jpg" width = "300" height =
"300"/>

What are the double slashes for?
</body>
</html>

and the image is not displayed although the proerties of the image
appear to be correct

Thank goodness. If URLs with ".." gave clients access higher than the
web root, clients would be able to access any file on the same drive
(unless access permissions were set with the greatest care, but that's
an immense burden and concern).

What you're supposed to do if you want a web site to include files in a
directory not under the web root is to create a virtual directory under
the web site in IIS (you mention wwwroot, so I assume you're talking
about IIS) that points to that physical directory so that, for example,

http://mysite.example.invalid/images/

points to your directory c:\mywebimages. Then

<img src="/images/x.gif">

will deliver c:\mywebimages\x.gif.
 
R

richard

Iain said:
Hi All

I want to store various objects at a level higher than wwwroot.

Is this possible
I have the following test html program

Your host determines what is the highest level at which you have access.
If you try that method, you'll most like get an error stating "access
denied".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,533
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top