如何使用内容类型:多部分/相关 [英] How to use Content-Type: Multipart/Related

查看:80
本文介绍了如何使用内容类型:多部分/相关的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想向用户发送一个二进制文件,并在浏览器中显示一些HTML.我在apache2中使用了CGI-BIN脚本.我在第4页上找到了此示例.该链接还显示有关多部分/相关内容类型的详细信息.这是我到目前为止尝试过的:

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

Content-Type 第一行之后的整个内容显示为单个纯文本附件.如何使浏览器说出 hi ,并提示下载内容为 ... myfile ?

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 ...?

推荐答案

我不认为浏览器理解多部分MIME响应

i do not think browsers understand multipart MIME responses

这篇关于如何使用内容类型:多部分/相关的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆