function _webform_submit_file in Webform 6.3
Same name and namespace in other branches
- 5.2 components/file.inc \_webform_submit_file()
- 5 components/file.inc \_webform_submit_file()
- 6.2 components/file.inc \_webform_submit_file()
- 7.4 components/file.inc \_webform_submit_file()
- 7.3 components/file.inc \_webform_submit_file()
Implements _webform_submit_component().
File
- components/
file.inc, line 464 - Webform module file component.
Code
function _webform_submit_file($component, $value) {
if ($value['_fid'] && ($file = webform_get_file($value['_fid']))) {
// Save any new files permanently.
file_set_status($file, FILE_STATUS_PERMANENT);
// Delete any previous files.
if ($value['_old'] && $value['_old'] != $value['_fid'] && ($existing = webform_get_file($value['_old']))) {
file_delete($existing->filepath);
db_query("DELETE FROM {files} WHERE fid = %d", $existing->fid);
}
$value = $file->fid;
}
else {
$value = $value['_old'] ? $value['_old'] : NULL;
}
return $value;
}