bp_document_download_file_force( string $file_path, string $filename )

Force download – this is the default method.

Description

Parameters

$file_path

(string) (Required) File path.

$filename

(string) (Required) File name.

Source

File: bp-document/bp-document-filters.php

function bp_document_download_file_force( $file_path, $filename ) {
	$parsed_file_path  = bp_document_parse_file_path( $file_path );
	$download_range   = bp_document_get_download_range( @filesize( $parsed_file_path['file_path'] ) ); // @codingStandardsIgnoreLine.

	bp_document_download_headers( $parsed_file_path['file_path'], $filename, $download_range );

	$start  = isset( $download_range['start'] ) ? $download_range['start'] : 0;
	$length = isset( $download_range['length'] ) ? $download_range['length'] : 0;
	if ( ! bp_document_readfile_chunked( $parsed_file_path['file_path'], $start, $length ) ) {
		if ( $parsed_file_path['remote_file'] ) {
			bp_document_download_file_redirect( $file_path );
		} else {
			bp_document_download_error( __( 'File not found', 'buddyboss' ) );
		}
	}

	exit;
}

Changelog

Changelog
Version Description
BuddyBoss 1.4.1 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.