2010-05-23 03:24
浏览 89


Is it possible to get a url/downloaded file name change the "%20" to spaces? Like instead of downloading the file my%20file.pdf, download my file.pdf? I'd like to use PHP if possible...

图片转代码服务由CSDN问答提供 功能建议

是否可以获取网址/下载的文件名将“%20”更改为空格? 喜欢而不是下载文件 my%20file.pdf ,而不是下载 my file.pdf ? 如果可能,我想使用PHP ...

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • dsa99349 2010-05-23 03:28

    I think you can use the Content-Disposition header to force a "Save As" dialog and recommend a file name like so:

    header('Content-Disposition: attachment; filename="my file.pdf"');

    The PHP.net page on header() seems to suggest the same.

    点赞 评论
  • douba3943 2010-05-23 03:27

    You will need to make use of the Content-disposition header.

    Here's a relevant answer. Here's what the header might look like:

    Content-disposition: attachment; filename=my file.pdf

    You could also use the reference for the header() function.

    点赞 评论

相关推荐 更多相似问题