bp_media_download_file_force( string $file_path, string $filename )
Force download – this is the default method.
Description
Parameters
- $file_path
-
(Required) File path.
- $filename
-
(Required) File name.
Source
File: bp-media/bp-media-filters.php
function bp_media_download_file_force( $file_path, $filename ) { $parsed_file_path = bp_media_parse_file_path( $file_path ); $download_range = bp_media_get_download_range( @filesize( $parsed_file_path['file_path'] ) ); // @codingStandardsIgnoreLine. bp_media_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_media_readfile_chunked( $parsed_file_path['file_path'], $start, $length ) ) { if ( $parsed_file_path['remote_file'] ) { bp_media_download_file_redirect( $file_path ); } else { bp_media_download_error( __( 'File not found', 'buddyboss' ) ); } } exit; }
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.