3

Is there any way through SQL commands, to import files into a custom field? E.g. photos of contacts?

2

You asked about SQL, but it is generally recommended to use the API rather than direct SQL. See the Attachment API - examples in the Code Docs section of API Explorer.

1

I would do one manually with the UI, then look at tables civicrm_file, civicrm_entity_file, and the custom table to see what it creates, then base it on that. The name of the custom table depends on what field group you've put the field in, but it starts with civicrm_value_XXX.

You might also want changelog records (civicrm_log) and would need to deal with the filename suffixes that it adds to make it harder to guess the filenames for url hacking. See Aidan's answer for an alternative using php that should handle all this for you.

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.