Skip to content

Commit 0ff48ed

Browse files
committed
Issue #4 Fix download problem on iOS devices
1 parent 95579b0 commit 0ff48ed

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/File.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,12 @@ public function send($filename = null, $contentType, $inline = false)
7474
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
7575
header('Content-Type: '.$contentType);
7676
header('Content-Transfer-Encoding: binary');
77-
header('Content-Length: '.filesize($this->_fileName));
77+
78+
// #84: Content-Length leads to "network connection was lost" on iOS
79+
$isIOS = preg_match('/i(phone|pad|pod)/i', $_SERVER['HTTP_USER_AGENT']);
80+
if (!$isIOS) {
81+
header('Content-Length: '.filesize($this->_fileName));
82+
}
7883

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

0 commit comments

Comments
 (0)