You can't set multiple HTTP headers in one call. Once a certain content-type is set in the HTTP header, you're stuck with it. You can however generate different data & content-types depending on certain parameters... check Re: Displaying randomly created png's in HTML for more specifics and a link to the correct RFC.
Greetz
Beatnik
... Quidquid perl dictum sit, altum viditur. | [reply] |
These are two separate web server requests. The first one fetches the html document with the IMG SRC=/cgi-bin/images/whatever.png. This content type should be set to text/html.
The web browser will make a separate request for whatever.png. This will be a separate cgi script that just sets the content type to image/png (i think) and basically prints the binary image file.
| [reply] |
"I have a script which needs to output both html and graphics on the same page. " and
"..., it appears I will need to send two content-type headers ( text/html and image/png )."
The question was kinda tricky. My response did include the two request solution.
I doubt Cines answer below actually works on web browsers. MIME types and HTTP content-types are similar but not exactly the same.
Greetz
Beatnik
... Quidquid perl dictum sit, altum viditur.
| [reply] |
Take a look at the bugzilla 2.12 package's buglist.cgi line 887-, which does almost what you are asking.
It basicly comes down to that the first header you send you tell that what you are sending is a multipart message, where the first is your html and the second is your png picture.
T
I
M
T
O
W
T
D
I | [reply] |