|
Clicking attached image doesn't show in Mozilla
Hi,
When you see a case with an attached image, it works fine in IE and Mozilla based browsers, but it you then click on the image, it doesn't show in Mozilla based browsers: you're a missing a
@header("Content-type: whatever");
in download.php, given than Mozilla does not file sniffing for guessing content-types.
A quick fix for this is using the mime_content_type() function, which has the additional benefit of adding proper support for many other file types.
if (@function_exists("mime_content_type")) {
$mimetype = @mime_content_type($filename);
if (!empty($mimetype) {
@header("Content-type: ".$mimetype);
}
}
You need to enable mime support for this, but with the check from above, it's safe to use it: people with mime support benefit from this, rest of people will have the current behaviour.
Angel Fradejas
Wednesday, January 28, 2004
You mean because Mozilla prompts you to save the file instead of showing it to you in the browser?
Michael H. Pryor
Wednesday, January 28, 2004
No, I mean Mozilla-based browsers display garbage, as they do not try to guess the file-type. They rely on a proper content-type header.
Angel Fradejas
Thursday, January 29, 2004
Ok, I can't reproduce this. I need more details on your OS and the exact versions of
* your browser
* php
* httpd
* mysql
Michael H. Pryor (fogcreek)
Thursday, January 29, 2004
Currently the content-type is already set. If it is not known it is set to application/octet-stream which all browsers will prompt to save. I think this might be a problem with the mime type settings on your webserver, but I'm not sure.
Oh yes, and what version of fogbugz are you running?
Michael H. Pryor (fogcreek)
Thursday, January 29, 2004
unix fogbugz 3.1.12
Regarding the content-type, octect-stream should be ok (although is would be more desirable to tag well-known file-extensions with the proper content-type, as images), but what i'm gettting is a text/html content-type, which is obviously wrong.
request:
GET /download.php?ixBugEvent=127&sFileName=submenu_stats.jpg&sFile=yes HTTP/1.1
response_
HTTP/1.x 200 OK
Content-Type: text/html
I'd go for my suggested solution with mime_content_type() function.
Angel Fradejas
Friday, January 30, 2004
Recent Topics
Fog Creek Home
|