4

I have civicrm installed with Drupal. I was not able to find how to create a multiple file upload using a civicrm custom data field. By default it allows only single file to be uploaded at a time. I require some 'Add more' type of functionality in CiviCRM.

4

When you create the Custom Field Set for contacts*, you can check the box that says "Does this Custom Field Set allow multiple records?":

Custom Field Set / Multiple records

From the book:

Multiple record fieldsets

By default custom data sets have a 'one-to-one' relationship to the entity they are attached to. For example, one field set for a person's physical attributes which contains one field for their height and one for their eye colour will be attached to one individual record. This makes sense because we only ever need to record one eye colour and one height for each person. However, in certain circumstances, we want to record multiple custom field sets for a single contact, for example, when recording a person's educational history. In this case, a single person may have multiple educational degrees, so a custom field set about educational history, which contains fields for subject, institution, and grade, should allow multiple records, and this is what multiple record fieldsets allow.

You can only add multiple record field sets to contacts - you can't add them to other entities. To use this option, select the "Does this Custom Field Set allow multiple records?" option. A few things to bear in mind when creating mutiple record custom field sets:

  • Multiple data applies to the whole field set, not to individual fields.
  • Multiple data be can only be added to Contacts. It cannot be added to Activities, or Contributions, etc.
  • Mutiple data cannot currently be exported
  • Before deciding to model something as a multiple value custom field set, you may wish to consider whether it could or should be modelled as an activity. For example, an educational degree could be an activity with custom data added.
  • 1
    Yeah, that correct. I have awared about this but there my issue coming in. I have to create an file upload field to attach as many file as user wants. i.e. we know that only civicrm field sets can be set as 'multiple data'. But what if we want an single custom field to upload multiple file ? It's an strong requirement. – Juyal Jee May 26 '15 at 15:33
  • The only way I know of is to allow multiple files is to create a profile (with only the single field in it if it's the only field that should be multiple). If anyone else knows another way, I'll be interested, too. – Laryn - CEDC.org May 26 '15 at 20:29
2

CiviCRM does not have this capability at present, but it could be created for your site.

Using a file field in a repeating fieldset is the only way to add an undetermined number of files to an object in CiviCRM, though there is a configurable maximum number of repetitions. You could also add a set number of file fields that should be sufficient for most use cases. The former will look a bit nicer.

Once you have defined the fields to store the (references to the) uploaded files, you will need to create your own upload page to handle multiple simultaneous uploads. Look for a pre-existing function in jQuery that can do this, or in a different library compatible with the CiviCRM browser technology stack.

  • 1
    Yeah, but i have to use that file upload field in both type of custom fieldsets i.e. mutivalue as well as single value. May be jquery will be helpful to display more than one field but our main concern is to save those values and also display them while generating reports for contacts. – Juyal Jee May 27 '15 at 6:05
  • 1
    @JuyalJee - Were you able to figure this out? – Moe Nov 7 at 14:07
  • @JuyalJee - Same here. If you found a solution, please DO share. Facing similar problem – ArisK Nov 14 at 15:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.