function hook_file_transfer in File Entity (fieldable files) 8.2
Same name and namespace in other branches
- 7.3 file_entity.api.php \hook_file_transfer()
- 7.2 file_entity.api.php \hook_file_transfer()
React to a file being downloaded.
1 invocation of hook_file_transfer()
- FileController::download in src/
Controller/ FileController.php - Returns a HTTP response for a file being downloaded.
File
- ./
file_entity.api.php, line 43 - Hooks provided by the File Entity module.
Code
function hook_file_transfer($uri, array $headers) {
// Redirect a download for an S3 file to the actual location.
if (StreamWrapperManager::getScheme($uri) == 's3') {
$url = file_create_url($uri);
drupal_goto($url);
}
}