Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Sep : Re: Browser image requests - no path info in GET
| Subject: | Re: Browser image requests - no path info in GET |
| Posted by: | "Remy Lebeau (TeamB)" (no.spam@no.spam.com) |
| Date: | Fri, 29 Sep 2006 13:30:15 |
" when expanded by the browser. That
results in a "GET /image.jpg" request.
It is your server code's responsibility to determine what physical folder
relates to the URL's '/' root folder, and then apply the rest of the URL to
that physical folder. So if your root folder is at
"C:\root\genfiles\temp\777", then a URL of "/image.jpg" would serve up
"C:\root\genfiles\temp\777\image.jpg".
> For example, this call:
<snip>
> Generates the following image call by the browser is:
> GET \headerlogo.jpg
What does the actual HTML look like? What URL is the browser actually using
to access report67.htm?
Chances are, the page is being loaded via a URL that specifies the HTML file
is in the server's root folder, and the HTML contains a relative URL for the
image, so the browser requests the image from the same root folder that the
HTML file is requested from. Or else the HTML file is not in the root
folder, but the HTML contains an image URL that begins with "/", so the
browser is forced to load the image from the server's root folder.
> What I would like to get from the browser is obvious:
> GET \root\genfiles\temp\777\headerlogo.jpg
For that to work, the URL of the HTML file would have to be
"http://www.server.com/root/genfiles/temp/777/page.html", or if the HTML
contains an image URL of "/root/genfiles/temp/777/headerlogo.jpg".
> The image(s) are located down in the 777 directory, not in the root.
From the perspective of your file system, that is correct. But not from the
perspective of the URLs that are involved. All URLs for the erver are
relative to the server's "/" root folder. Where the "/" actually points to
on your file system, that is up to your own code to manage.
> How can I have GET image references use either,
> the same directory stem as the original htm file
By learning how HTTP and URLs actually work, and then update your code to
use them properly. To load an image from the same folder as the HTML file,
the HTML has simply to specify the image filename with no path, and the
browser will expand the filename into a full URL accordingly. When a
request is made to the server, the request always contains a full path
starting at the "/" root folder, in terms of HTTP paths, not in terms of
file system paths. You have to translate between the two in your code.
> Possibly by setting values in requestinfo or responseinfo??
No.
Gambit
none