views:

58

answers:

0

I want to send a binary file to the user and have some HTML display on the browser. I'm using a CGI-BIN script with apache2. I found this example on page 4. The link also shows details about the multipart/related content-type. Here's what I tried so far:

Content-Type: Multipart/Related; boundary="boundary-content"; start=""; type=\"text/plain\""

--boundary-content
Content-Disposition: inline
Content Type:text/plain
Content-ID: <abc>

hi

--boundary-content
Content Type:application/octet-stream
Content-Disposition: attachment;filename=myfile
Content-ID: 2

...

--boundary-content

The whole thing after the first Content-Type line shows up as a single plaintext attachment. How can I make the browser say hi and prompt to download myfile with contents of ...?