CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Custom value API on file fields
Pages: [1]

Author Topic: Custom value API on file fields  (Read 491 times)

jaapjansma

  • I post frequently
  • ***
  • Posts: 247
  • Karma: 9
    • CiviCoop
  • CiviCRM version: 4.4.2
  • CMS version: Drupal 7
  • MySQL version: 5
  • PHP version: 5.4
Custom value API on file fields
April 23, 2014, 04:00:36 am
Hey Folks,

Is it possible to use the custom value API or the custom_n= notation when the field is a File upload field?
I want to attach files to the field which comes from an external source within my extension.

Jaap
Developer at Edeveloper / CiviCoop

homebrewruss

  • I’m new here
  • *
  • Posts: 10
  • Karma: 0
  • CiviCRM version: 4.2
  • CMS version: Drupal 7
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Custom value API on file fields
July 10, 2014, 08:53:22 am
Hi Jaap,
Seems no-one replied to your original question but I think I'm looking for the same thing.
I have a file uploaded via a drupal webform which I also want to upload into a custom field in CiviCRM - did you work out a way to do this using the CiviCRM api?

Thanks
Russ

jaapjansma

  • I post frequently
  • ***
  • Posts: 247
  • Karma: 9
    • CiviCoop
  • CiviCRM version: 4.4.2
  • CMS version: Drupal 7
  • MySQL version: 5
  • PHP version: 5.4
Re: Custom value API on file fields
July 11, 2014, 01:30:04 am
Hey Russ,

I ended up using drupal hooks for form submission and then check for any fileupload field and then save the file from there into civicrm with File BAO.

You can see my code on github: https://github.com/CiviCooP/org.civicoop.documents/blob/master/drupal/webform_civicrm_documents/webform_civicrm_documents.module and the actuall handling code on https://github.com/CiviCooP/org.civicoop.documents/blob/master/drupal/webform_civicrm_documents/WebformCiviCRMDocuments.inc
Developer at Edeveloper / CiviCoop

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Custom value API on file fields

This forum was archived on 2017-11-26.