function webform_file_download in Webform 5
Same name and namespace in other branches
- 8.5 webform.module \webform_file_download()
- 5.2 webform.module \webform_file_download()
- 6.3 webform.module \webform_file_download()
- 6.2 webform.module \webform_file_download()
- 7.4 webform.module \webform_file_download()
- 7.3 webform.module \webform_file_download()
- 6.x webform.module \webform_file_download()
Implementation of hook_file_download().
Only allow users with view webform submissions to download files.
File
- ./
webform.module, line 1138
Code
function webform_file_download($file) {
$file = file_check_location(file_directory_path() . '/' . $file, file_directory_path() . '/webform/');
if ($file && user_access('access webform results')) {
$info = image_get_info(file_create_path($file));
return array(
'Content-type: ' . $info['mime_type'],
);
}
}