Skip to content

Commit

Permalink
content-type bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
rauwebieten committed Sep 13, 2017
1 parent b37d158 commit 490194f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Psr7PartialDownload.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public function sendFile(ServerRequestInterface $request, ResponseInterface $res
$invalidChars = array('<', '>', '?', '"', ':', '|', '\\', '/', '*', '&');
$fileName = str_replace($invalidChars, '', $fileName);

$response = $response->withHeader('Content-Type', $contentType);
$response = $response->withHeader('Accept-Ranges', 'bytes');
$response = $response->withHeader('Content-Disposition', "attachment; filename=\"{$fileName}\"");

Expand All @@ -48,7 +49,7 @@ public function sendFile(ServerRequestInterface $request, ResponseInterface $res
}

$byteRange = $byteLength - $byteOffset;
$response = $response->withHeader('Content-Langth', $byteRange);
$response = $response->withHeader('Content-Length', $byteRange);
$response = $response->withHeader('Expires', date('D, d M Y H:i:s', time() + 60*60*24*90) . ' GMT');

$bufferSize = 512*16;
Expand Down

0 comments on commit 490194f

Please sign in to comment.