4. Content-Disposition 详解

文章目录

    文件下载响应头的设置
    Server 端实现文件下载

文件下载响应头的设置

content-type 指示响应内容的格式

content-disposition 指示如何处理响应内容。

一般有两种方式:

    inline:直接在页面显示
    attchment:以附件形式下载

Server 端实现文件下载

    打开文件,将文件内容写入到 reponse 中
    设置 Response header(content-disposition,content-type)

代码示例:

Content-Type: application/octet-stream
Content-Disposition: attachment;filename=2018-03-03_15-47-45--2019-03-03_15-48-13--73c75b84-ba2a-470f-a71

https://blog.csdn.net/hukfei/article/details/88120353
posted @ 2023-03-08 13:42  甜菜波波  阅读(493)  评论(0编辑  收藏  举报