简体   繁体   English

在文件名中下载带空格的标题

[英]Header for download with space in filename

How do I set the right header if the filename should have a space in the name? 如果文件名在名称中有空格,如何设置正确的标题?

I tried 我试过了

header( "Content-Disposition: attachment; filename=a fielename with spaces.txt");

but that gives only the suggested fielname "a" and cuts off the rest. 但这只给出了建议的fielname“a”并切断了其余部分。

$file_name = 'a fielename with spaces.txt';
header("Content-disposition: attachment; filename=\"".$file_name."\""); 
header( 'Content-Disposition: attachment; filename="a fielename with spaces.txt"');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM