文件名中有空格的下载头


Header for download with space in filename

如果文件名中应该有一个空格,我如何设置正确的标题?

我试着

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

,但它只给出建议的字段名"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"');