views:

135

answers:

1

i write and my page loads it find. When i click on the link instead of having the image show on screen it promps me to download it. Why? How can i make it display in the browser? gif and jpg both display in the browser.

-edit- i am using FireFox 3.5 there is no code that serves it, its just a link and the file exist in my folder. The link is like http://localhost:1737/a/b/file.png. IE 8 displays the png w/o making me download. I havent tried with other browsers but surely i click on direct png link in firefox on every site mine (in VS) should act the same.

+3  A: 

If you're fetching it with HTTP, then there is a web server serving it. Look at the MIME-type when its returned, is that set correctly?

Telnet to localhost on port 1737 (not sure the syntax on Windows but IIRC try telnet localhost 1737) and type:

GET /a/b/file.png HTTP/1.0

Followed by two returns. Look at the Content-Type: field in the header. If it's not something like image/png you have a problem serving it. Firefox may have been guessing from the file name.

Joe
Using tamper data in firefox it looks like it is `Content-Type=application/octet-stream` (thats what firefox seems to report). Is there a way to change this without getting dirty in code?
acidzombie24
There's your problem. I have no idea how your web server handles things, but other servers are able to alter the headers based on the file extension. There is sure to be a configuration setting somewhere. If you're using IIS, try taking a look at this: http://technet.microsoft.com/en-us/library/bb742440.aspx
Joe