Skip to content

Commit 886734d

Browse files
committed
Issue #14 Fix filenames with spaces
1 parent e733207 commit 886734d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/File.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,11 @@ public function send($filename = null, $contentType, $inline = false)
8989

9090
if ($filename !== null || $inline) {
9191
$disposition = $inline ? 'inline' : 'attachment';
92+
$encodedFilename = rawurlencode($filename);
9293
header(
93-
'Content-Disposition: ' . $disposition .
94-
'; filename=' . $filename .
95-
"; filename*=UTF-8''" . rawurlencode($filename)
94+
"Content-Disposition: $disposition; " .
95+
"filename=\"$filename\"; " .
96+
"filename*=UTF-8''$encodedFilename"
9697
);
9798
}
9899

0 commit comments

Comments
 (0)