Microweber\Utils\Files::_readfile_laravel_chunked PHP Method

_readfile_laravel_chunked() private method

private _readfile_laravel_chunked ( $path, $name = null, array $headers = [] )
$headers array
    private function _readfile_laravel_chunked($path, $name = null, array $headers = array())
    {
        if (is_null($name)) {
            $name = basename($path);
        }
        // Prepare the headers
        $headers = array_merge(array('Content-Description' => 'File Transfer', 'Content-Type' => \File::mime(\File::extension($path)), 'Content-Transfer-Encoding' => 'binary', 'Expires' => 0, 'Cache-Control' => 'must-revalidate, post-check=0, pre-check=0', 'Pragma' => 'public', 'Content-Length' => \File::size($path)), $headers);
        $response = new \Response('', 200, $headers);
        $response->header('Content-Disposition', $response->disposition($name));
        // If there's a session we should save it now
        if (\Config::get('session.driver') !== '') {
            \Session::save();
        }
        // Send the headers and the file
        ob_end_clean();
        $response->send_headers();
        if ($fp = fread($path, 'rb')) {
            while (!feof($fp) and connection_status() == 0) {
                echo fread($fp, 8192);
                flush();
            }
        }
        // Finish off, like Laravel would
        \Event::fire('laravel.done', array($response));
        $response->foundation->finish();
        exit;
    }