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.
2 Answers
When you create the Custom Field Set for contacts*, you can check the box that says "Does this Custom Field Set allow multiple records?":
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.
-
1Yeah, 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. May 26, 2015 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.– LarynMay 26, 2015 at 20:29
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.
-
1Yeah, 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. May 27, 2015 at 6:05
-
1
-
@JuyalJee - Same here. If you found a solution, please DO share. Facing similar problem– ArisKNov 14, 2019 at 15:11