src/sb/Files/ForceDownload.php
public static function send($file, $display_file_name = '', $seekat=0)
    {
        $display_file_name = $display_file_name ? $display_file_name : basename($file);
        $display_file_name = str_replace(" ", "_", $display_file_name);
        header("HTTP/1.1 200 OK");
        header("Status: 200 OK");
        header("Pragma: private");
        header("Expires: 0");
        header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
        header("Content-Transfer-Encoding: Binary");
        header('Content-Type: application/force-download');
        header('Content-disposition: attachment; filename="'.$display_file_name.'"');

        while (ob_get_level() > 0) {
            ob_end_flush();
        }
        \sb\Files::readChunked($file, $seekat);
    }
public static function send($file, $display_file_name = '', $seekat=0)
    {
        $display_file_name = $display_file_name ? $display_file_name : basename($file);
        $display_file_name = str_replace(" ", "_", $display_file_name);
        header("HTTP/1.1 200 OK");
        header("Status: 200 OK");
        header("Pragma: private");
        header("Expires: 0");
        header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
        header("Content-Transfer-Encoding: Binary");
        header('Content-Type: application/force-download');
        header('Content-disposition: attachment; filename="'.$display_file_name.'"');

        while (ob_get_level() > 0) {
            ob_end_flush();
        }
        \sb\Files::readChunked($file, $seekat);
    }
public static function send ( $ file , $ display_file_name = '' , $ seekat = 0 ) { $ display_file_name = $ display_file_name ? $ display_file_name : basename ( $ file ) ; $ display_file_name = str_replace ( " " , "_" , $ display_file_name ) ; header ( "HTTP/1.1 200 OK" ) ; header ( "Status: 200 OK" ) ; header ( "Pragma: private" ) ; header ( "Expires: 0" ) ; header ( "Cache-Control: must-revalidate, post-check=0, pre-check=0" ) ; header ( "Content-Transfer-Encoding: Binary" ) ; header ( 'Content-Type: application/force-download' ) ; header ( 'Content-disposition: attachment; filename="' . $ display_file_name . '"' ) ; while ( ob_get_level ( ) > 0 ) { ob_end_flush ( ) ; } \ sb \ Files :: readChunked ( $ file , $ seekat ) ; }
Send headers and begins force-download

@param string $file The path to the file to force download
@param string $display_file_name The filename to give to the
@param int $seekat Where to start in file stream
force download if different than the basename of the file arg
Send headers and begins force - download