function webform_civicrm_filepath in Webform CiviCRM Integration 7.2
Same name and namespace in other branches
- 6.2 webform_civicrm_d6_functions.inc \webform_civicrm_filepath()
Fetch the path of a file And format it as a public url that CiviCRM can read
1 call to webform_civicrm_filepath()
- webform_civicrm_process_submission in ./
webform_civicrm_forms.inc - Webform submission handler Create/update CiviCRM contacts and related data Called by presave, insert and update webform hooks
File
- ./
webform_civicrm_d7_functions.inc, line 80 - Keep all functions specific to a version of Drupal here, to allow the rest of the code to be version-independent.
Code
function webform_civicrm_filepath($id) {
if ($file = file_load($id)) {
global $base_url;
return str_replace('public://', $base_url . '/' . variable_get('file_public_path', conf_path() . '/files') . '/', str_replace(array(
'%3A',
'%2F',
), array(
':',
'/',
), rawurlencode($file->uri)));
}
}