function webform_file_allow_access in Webform 7.4
Same name and namespace in other branches
- 7.3 components/file.inc \webform_file_allow_access()
Pre-render callback to allow access to uploaded files.
Files that have not yet been saved into a submission must be accessible to the user who uploaded it, but no one else. After the submission is saved, access is granted through the file_usage table. Before then, we use a $_SESSION value to record a user's upload.
See also
1 string reference to 'webform_file_allow_access'
- _webform_render_file in components/
file.inc - Implements _webform_render_component().
File
- components/
file.inc, line 437 - Webform module file component.
Code
function webform_file_allow_access($element) {
if (!empty($element['#value']['fid'])) {
$fid = $element['#value']['fid'];
$_SESSION['webform_files'][$fid] = $fid;
}
return $element;
}