Skip to content

Commit

Permalink
Issue #4 Fix download problem on iOS devices
Browse files Browse the repository at this point in the history
  • Loading branch information
mikehaertl committed Aug 28, 2017
1 parent 95579b0 commit 0ff48ed
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,12 @@ public function send($filename = null, $contentType, $inline = false)
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Content-Type: '.$contentType);
header('Content-Transfer-Encoding: binary');
header('Content-Length: '.filesize($this->_fileName));

// #84: Content-Length leads to "network connection was lost" on iOS
$isIOS = preg_match('/i(phone|pad|pod)/i', $_SERVER['HTTP_USER_AGENT']);
if (!$isIOS) {
header('Content-Length: '.filesize($this->_fileName));
}

if ($filename!==null || $inline) {
$disposition = $inline ? 'inline' : 'attachment';
Expand Down

0 comments on commit 0ff48ed

Please sign in to comment.