You are here

function webform_civicrm_filepath in Webform CiviCRM Integration 6.2

Same name and namespace in other branches
  1. 7.2 webform_civicrm_d7_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_d6_functions.inc, line 115
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 ($path = db_result(db_query('SELECT filepath FROM {files} WHERE fid = %d', $id))) {
    global $base_url;
    return $base_url . '/' . str_replace(array(
      '%3A',
      '%2F',
    ), array(
      ':',
      '/',
    ), rawurlencode($path));
  }
}