I want to import many pdfs into Civi and so need to make the link between the uploaded pdf and the database table. I used the UI to upload a sample pdf (calke_walk.pdf) and looking at the db table, the field in question contains an int(10) unsigned with a value of 8. The uploaded pdf has a file name of Calke_walk_a0e8f5791bb72c5b53c253f4fa66fd2f.pdf In Civi's UI the file has a url that ends with &id=8&eid=28308 The clue there is the &id=8 I guess, but is there more to this that I need to know?
Try using the attachment api, it will handle the nitty-gritty for you.
-
I cannot find any examples of the attachment api - and no documentation either apart from your link. Can you suggest where to look for an example of this api being used in Civi? Thanks – Andy Clark Aug 11 '15 at 9:21
-
1In the 4.6+ api explorer (use the demo server if you haven't upgraded) go to the "Code Docs" tab and look it up. – Coleman Aug 11 '15 at 12:08