function wf_crm_filepath in Webform CiviCRM Integration 7.3
Fetch the path of a file And format it as a public url that CiviCRM can read
Parameters
$id: Drupal file id
Return value
string|void: url of file if found
1 call to wf_crm_filepath()
- _wf_crm_form_data in ./
webform_civicrm_forms.inc - Dispatch function to fill data array with submitted form values Called during webform submission
File
- ./
webform_civicrm_utils.inc, line 1488 - Webform CiviCRM module's common utility functions.
Code
function wf_crm_filepath($id) {
if ($file = file_load($id)) {
global $base_url;
// Escape all characters except : and /
return str_replace('public://', $base_url . '/' . variable_get('file_public_path', conf_path() . '/files') . '/', str_replace(array(
'%3A',
'%2F',
), array(
':',
'/',
), rawurlencode($file->uri)));
}
}