Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Get Image from Shared Folder on Server

Status
Not open for further replies.

byrne1

Programmer
Aug 7, 2001
415
US
I want to access an image that is in a shared folder on the server. The shared folder is NOT in the INETPUB folder and it cannot be moved. The directory structure of the shared folder is similar to the following:

SERVER:
F:
|_IMAGES
|_BOATS
|_FIREBOATS
|_FIREBOAT1.JPG

In this scenario, the IMAGES folder is shared as "IMAGES" to Everyone and IUSR. In my HTML code I have the following:

<image src="\\SERVER\IMAGES\BOATS\FIREBOATS\FIREBOAT1.JPG">

But when I load the page I just get the generic graphic box indicating the image file could not be found.

What am I missing here???
 
Where is your page?

--Chessbot

"So it goes."
Kurt Vonnegut, Slaughterhouse Five
 
My page is in a virtual directory whose pages reside in F:\PICS.
 
What about:

<img src="../images/boats/fireboats/fireboat1.jpg">

If this doesn't work, I'll assume you haven't set your web server to allow access to a directory in the root directory.

*cLFlaVA
----------------------------
Lois: "Peter, you're drunk!"
Peter: "I'm not drunk, I'm just exhausted from stayin' up all night drinking!
 
I've tried that and I believe I have the settings on my web server correct. I've enabled the checkbox that reads "enable parent paths".
 
I made an incorrect statement earlier. My page is in D:\PICS and the image that I want to access is F:\IMAGES\BOATS\FIREBOATS\FIREBOAT1.JPG. The IMAGES folder is shared as IMAGES with rights to IUSR.

So I'm actually trying to link to another drive, not just another directory. Is this possible???
 
Use an absolute path.

<img src="F:\images\boats\fireboats\fireboat1.jpg">

--Chessbot

"So it goes."
Kurt Vonnegut, Slaughterhouse Five
 
I tried the absolute path just as you suggested but it still does not work.
 
I'm sorry if you've given enough information for me to guess by now, but what OS are you on? I have very littler experience in non-Windows OS.

--Chessbot

"So it goes."
Kurt Vonnegut, Slaughterhouse Five
 
No problem. The web server is running Windows Server 2003 and my client is running XP Pro SP2.
 
Just to make sure that the path is correct:

Navigate to the image.
Right-click and select Properties.
Select the path.
Use as your source that path plus the name of your file.

--Chessbot

"So it goes."
Kurt Vonnegut, Slaughterhouse Five
 
Yep, I've checked and checked the path again and again just to be sure. It's right. I'm going to sleep on it and try again on Monday.
 
You can't directly access an image that's outside your web space - it's a security feature. You wouldn't want people to able to access any file on your webserver simply by typing the right URL would you?

Are you able to use server-side scripting? A script running on the server could access any directory - so you could write one that would fetch the image and pass it on. The URL could then be something like:

example.com/cgi-bin/getpic.pl?name=myimage.jpg

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
<img src="F:\images\boats\fireboats\fireboat1.jpg">

Assuming the F: drive is share-able what about:

<img src=\\servername\images\boats\fireboats\fireboat1.jpg">


 
Additionally, I would personally use \\192.168.0.1\IMAGES\BOATS\FIREBOATS\FIREBOAT1.JPG rather than \\SERVER\ just in case you decide to move the network to multiple subnets later on and the IP can't be resolved. Shouldn't make a difference but I have come across that problem previously.


That did the trick! It would not work when I tried to reference the file with the server DNS name (ie, IMAGESERVER) but it worked when I referenced the file using the server's IP address.

Thank you to all who contributed!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top