You are here

function pfdp_force_download in Private files download permission 8.2

Same name and namespace in other branches
  1. 3.x pfdp.module \pfdp_force_download()

Forces a file to be downloaded to the browser.

1 call to pfdp_force_download()
pfdp_file_download in ./pfdp.module

File

./pfdp.module, line 55
Implements the main module function and generic helper functions.

Code

function pfdp_force_download($uri, $uri_download_headers) {

  // Create a response here and send it to the browser.
  $file = new BinaryFileResponse($uri, 200, $uri_download_headers, false);
  $file
    ->send();

  // Exit to avoid duplication of HTTP transmission.
  exit;
}