protected function _readChunked($path)
    {
        $chunksize = 1 * (1024 * 1024); // Chunk size
        $buffer = '';
        $cnt = 0;

        $handle = fopen($path, 'rb');

        if ($handle === false) {
            throw new KViewException('Cannot open file');
        }

        while (!feof($handle)) {
            $buffer = fread($handle, $chunksize);

            echo $buffer;

            @ob_flush();

            flush();

            $cnt += strlen($buffer);
        }

        $status = fclose($handle);

        return $cnt;
    }
protected function _readChunked($path)
    {
        $chunksize = 1 * (1024 * 1024); // Chunk size
        $buffer = '';
        $cnt = 0;

        $handle = fopen($path, 'rb');

        if ($handle === false) {
            throw new KViewException('Cannot open file');
        }

        while (!feof($handle)) {
            $buffer = fread($handle, $chunksize);

            echo $buffer;

            @ob_flush();

            flush();

            $cnt += strlen($buffer);
        }

        $status = fclose($handle);

        return $cnt;
    }
protected function _readChunked ( $ path ) { $ chunksize = 1 * ( 1024 * 1024 ) ; // Chunk size $ buffer = '' ; $ cnt = 0 ; $ handle = fopen ( $ path , 'rb' ) ; if ( $ handle === false ) { throw new KViewException ( 'Cannot open file' ) ; } while ( ! feof ( $ handle ) ) { $ buffer = fread ( $ handle , $ chunksize ) ; echo $ buffer ; @ ob_flush ( ) ; flush ( ) ; $ cnt += strlen ( $ buffer ) ; } $ status = fclose ( $ handle ) ; return $ cnt ; }
Read a file in chunks and flush it to the output stream.

@param  string 	Path to a file to be read

@return int Number of chunks being flushed
Read a file in chunks and flush it to the output stream .