src/classes/CCResponse.php
public function as_download( $filename = null ) 
	{
		if ( is_null( $filename ) ) 
		{
			$filename = 'file.'.CCStr::suffix( $this->header( 'Content-Type' ), '/' );
		}

		$this->header( 'Content-Description', 'File Transfer' );
		$this->header( 'Content-Disposition', 'attachment; filename='.$filename );
		$this->header( 'Content-Transfer-Encoding', 'binary' );
		$this->header( 'Expires', '0' );
		$this->header( 'Cache-Control', 'must-revalidate' );
		$this->header( 'Pragma', 'public' );
		$this->header( 'Content-Length', strlen( $this->body() ) );

		return $this;
	}
public function as_download( $filename = null ) 
	{
		if ( is_null( $filename ) ) 
		{
			$filename = 'file.'.CCStr::suffix( $this->header( 'Content-Type' ), '/' );
		}

		$this->header( 'Content-Description', 'File Transfer' );
		$this->header( 'Content-Disposition', 'attachment; filename='.$filename );
		$this->header( 'Content-Transfer-Encoding', 'binary' );
		$this->header( 'Expires', '0' );
		$this->header( 'Cache-Control', 'must-revalidate' );
		$this->header( 'Pragma', 'public' );
		$this->header( 'Content-Length', strlen( $this->body() ) );

		return $this;
	}
public function as_download ( $ filename = null ) { if ( is_null ( $ filename ) ) { $ filename = 'file.' . CCStr :: suffix ( $ this -> header ( 'Content-Type' ) , '/' ) ; } $ this -> header ( 'Content-Description' , 'File Transfer' ) ; $ this -> header ( 'Content-Disposition' , 'attachment; filename=' . $ filename ) ; $ this -> header ( 'Content-Transfer-Encoding' , 'binary' ) ; $ this -> header ( 'Expires' , '0' ) ; $ this -> header ( 'Cache-Control' , 'must-revalidate' ) ; $ this -> header ( 'Pragma' , 'public' ) ; $ this -> header ( 'Content-Length' , strlen ( $ this -> body ( ) ) ) ; return $ this ; }
modify the headers to force a download

@param string 	$filename
@return void
modify the headers to force a download