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) »
  • crm_create_file
Pages: [1]

Author Topic: crm_create_file  (Read 734 times)

CatorgHans

  • I post frequently
  • ***
  • Posts: 157
  • Karma: 5
  • CiviCRM version: 4.4
  • CMS version: drupal
crm_create_file
October 14, 2010, 07:40:44 am
I am trying to update someone's profile picture via a drupal form.

I am able to upload the file to wherever I want (also to civicrm/custom dir within the files dir),
but how do I attach that picture to a person in civicrm via the API?
I can use civicrm_contact_update with param "image_URL", but is that safe?

Does CiviCrm need extra "File handling" with crm_create_file( $params ) and/or crm_create_entity_file? If yes, how does that work?





Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: crm_create_file
October 15, 2010, 11:05:05 am
Quote
Does CiviCrm need extra "File handling" with crm_create_file( $params ) and/or crm_create_entity_file? If yes, how does that work?

Yes. Check http://wiki.civicrm.org/confluence/display/CRMDOC32/File+APIs

Kurund

Found this reply helpful? Support CiviCRM

CatorgHans

  • I post frequently
  • ***
  • Posts: 157
  • Karma: 5
  • CiviCRM version: 4.4
  • CMS version: drupal
Re: crm_create_file
October 19, 2010, 12:59:16 am
Yes I saw those, but that description is difficult to interpret.

I do not see when to use those functions, and also not how (what needs to be in the params, how is file_type_id used).
Do you have an example where these are used with the profile picture?

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: crm_create_file
October 19, 2010, 01:58:17 pm
Hi,

Agree, the documentation need more detailled explanation. When you figure out what are the right params, please do complete it (that's a wiki, you can register and edit).

To get you started on the investigation/debug, you might want to read this chapter:
http://en.flossmanuals.net/CiviCRM/DevelopAPI

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

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

This forum was archived on 2017-11-26.