diff --git a/src/FileDownload.php b/src/FileDownload.php index 5937279..bee5124 100644 --- a/src/FileDownload.php +++ b/src/FileDownload.php @@ -77,9 +77,13 @@ public function sendDownload ($filename, $forceDownload = true) header("Content-Transfer-Encoding: binary"); header("Content-Length: {$this->getFileSize()}"); - @ob_clean(); - - rewind($this->filePointer); + @ob_end_clean(); + + $meta = stream_get_meta_data($this->filePointer); + + if( $meta['seekable'] == true ) + rewind($this->filePointer); + fpassthru($this->filePointer); } @@ -159,4 +163,4 @@ public static function createFromString ($content) return new FileDownload($file); } -} \ No newline at end of file +}