如何在 Content

编程入门 行业动态 更新时间:2024-10-22 05:10:36
本文介绍了如何在 Content-Disposition 标头中设置包含空格的文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有这段代码:

resp.addHeader("Content-Disposition", "inline; filename=" + fileName);

当文件名为a_b_c.doc"或abc.doc"时,下载文件的名称显示正确.但是,当文件名为a b c .doc"时,下载文件的名称仅为a".

When the file name is "a_b_c.doc" or "abc.doc" the name of the downloaded file is displayed correctly. However, when the file name is "a b c .doc" the name of the downloaded file is only "a".

我们如何解决这个问题?

How can we solve this?

推荐答案

使用引号:

resp.addHeader("Content-Disposition", "inline; filename="" + fileName + """);

更多推荐

如何在 Content

本文发布于:2023-10-31 18:56:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1546979.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何在   Content

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!