Skip to content

Commit

Permalink
Merge pull request #15 from mikehaertl/14-fix-spaces-in-filenames
Browse files Browse the repository at this point in the history
Issue #14 Fix filenames with spaces
  • Loading branch information
mikehaertl authored May 6, 2020
2 parents e733207 + 886734d commit 0013625
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,11 @@ public function send($filename = null, $contentType, $inline = false)

if ($filename !== null || $inline) {
$disposition = $inline ? 'inline' : 'attachment';
$encodedFilename = rawurlencode($filename);
header(
'Content-Disposition: ' . $disposition .
'; filename=' . $filename .
"; filename*=UTF-8''" . rawurlencode($filename)
"Content-Disposition: $disposition; " .
"filename=\"$filename\"; " .
"filename*=UTF-8''$encodedFilename"
);
}

Expand Down

0 comments on commit 0013625

Please sign in to comment.