This documentation relates to CiviCRM version 3.2. It's not maintained anymore.
Current version of documentation.

File APIs

Skip to end of metadata
Go to start of metadata

This page refers to outdated version of CiviCRM. Check current version of documentation.


Documentation Search


CiviCRM 3.2 Documentation

Support and Participation

Developer Resources


CiviCRM book!

Make sure to check out Understanding CiviCRM as well! You can also support this project by ordering a hard copy.

File APIs

civicrm_create_file( $params )

Availability: v1.5

This API is used for creating a file
Required Parameter : 'file_type_id'

Parameters:

  • 'params' (array) an associative array of name/value property values of civicrm_file.

Returns:

  • array of newly created file property values

civicrm_get_file( $params )

Availability: v1.5

This api is used for finding an existing file.
Required parameters : id OR file_type_id of a file

Parameters:

  • 'params' (array) an associative array of name/value property values of civicrm_file

Returns:

  • Array of all found file property values.

civicrm_update_file( &$params )

Availability: v1.5

This api is used for updating an existing file.
Required parrmeters : id of a file

Parameters:

  • 'params' (array) an associative array of name/value property values of civicrm_file

Returns:

  • array of updated file property values

civicrm_delete_file( $fileId )

Availability: v1.5

This API is used for deleting a file
Required parameters : id of a file

Parameters:

  • 'fileId' (Int) Id of the file to be deleted

Returns:

  • null if successfull OR
  • object of CRM_Core_Error
Deleting a File

Deleting a File will result in deletion of all file_entity assignments for that file.

civicrm_create_entity_file(&$fileID, &$entityID, $entity_table = 'civicrm_contact')

Availability: v1.5

Assigns an entity to a file

Parameters:

  • 'fileID' (Int) id of a file
  • 'entityID' (Int) id of an entity
  • 'entity_table' (String)

Returns:

  • array of newly created entity-file property values

civicrm_get_files_by_entity(&$entityID, $entity_table = 'civicrm_contact')

Availability: v1.5

Returns all files assigned to a single entity instance.

Parameters:

  • 'entityID' (Int) id of an entity
  • 'entity_table' (String)

Returns:

  • nested array of entity-file property values

civicrm_delete_entity_file(&$param)

Availability: v1.5

Deletes an existing entity file assignment.
Required parameters :
1. id of an entity-file
2. entity_id and entity_table of an entity-file

Parameters:

  • 'params' (array) an associative array of name/value property values of civicrm_entity_file.

Returns:

  • null if successfull OR
  • object of CRM_Core_Error
Labels
  • None

Creative Commons License
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-Share Alike 3.0 United States Licence.