function _webform_attachments_component in Webform 6.3
Same name and namespace in other branches
- 7.4 webform.api.php \_webform_attachments_component()
- 7.3 webform.api.php \_webform_attachments_component()
Return an array of files associated with the component.
The output of this function will be used to attach files to e-mail messages.
Parameters
$component: A Webform component array.
$value: An array of information containing the submission result, directly correlating to the webform_submitted_data database schema.
Return value
An array of files, each file is an array with following keys:
- filepath: The relative path to the file.
- filename: The name of the file including the extension.
- filemime: The mimetype of the file.
This will result in an array looking something like this:
array[0] => array(
'filepath' => '/sites/default/files/attachment.txt',
'filename' => 'attachment.txt',
'filemime' => 'text/plain',
);
Related topics
File
- ./
webform.api.php, line 541 - Sample hooks demonstrating usage in Webform.
Code
function _webform_attachments_component($component, $value) {
$files = array();
$files[] = db_fetch_array(db_query("SELECT * FROM {files} WHERE fid = %d", $value[0]));
return $files;
}