如何使用内容类型:多部分/相关
我想向用户发送一个二进制文件,并在浏览器上显示一些 HTML。我正在使用 apache2 的 CGI-BIN 脚本。我在第 4 页找到了此示例。该链接还显示有关多部分/相关内容类型的详细信息。这是我到目前为止所尝试的:
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
?
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 ...
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为浏览器无法理解多部分 MIME 响应
i do not think browsers understand multipart MIME responses