1

Topic: How to upload CSV of occurrences with image path?

Hi,

I am trying to bulk upload occurrences which have images into my warehouse using the "Upload a CSV file" button at the bottom of the Occurrences page. Without images they upload correctly. If I put an image path in a field and tell it to map to the attribute "Image path 1" I get the following SQL error:

occurrence_medium:general: There was an SQL error: ERROR:  insert or update on table "occurrence_media" violates foreign key constraint "fk_occurrence_media_type"
DETAIL:  Key (media_type_id)=(0) is not present in table "termlists_terms". - INSERT INTO "occurrence_media" ("created_on", "created_by_id", "updated_on", "updated_by_id", "caption", "media_type_id", "path", "occurrence_id") VALUES ('20171115 14:09:54', 1, '20171115 14:09:54', 1, 'Test caption', 0, '10-02-2017 10-54-49.Image.084424.jpg', 554141)

It seems it is trying to add a value "0" instead of the default "123" to media_type_id. I don't see any field that I can map the media type to: under the mappable fields for Occurrence Image there is Image Caption 1 (to 4) and Image Path 1 (to 4) but nothing for image type.

How/where do I specify the image type?

Thanks in advance for any help...

2

Re: How to upload CSV of occurrences with image path?

Hi

As far as I can see, you don't specify the media type. It is simply left to take on the default value that exists on the database for that field. That does mean you are currently limited to importing image files (i.e sound, video, etc could not be imported currently).

It works fine for me.  As you mentioned recently, you are running an old version of the code which has received many fixes. It may be unrelated, but I can see one such that may be relevant at https://github.com/Indicia-Team/warehou … 4a3c30ff33

Jim Bacon

3

Re: How to upload CSV of occurrences with image path?

Okay, thanks Jim.

4

Re: How to upload CSV of occurrences with image path?

Ah, look at https://github.com/Indicia-Team/client_ … 1ec163748d

This sounds like the fix for your problem (probably combined with the other one above since they were both committed on the same day). You might be able to patch your code and get it working if you are careful.

Jim Bacon.

5

Re: How to upload CSV of occurrences with image path?

Yay! Patching those two files has fixed it and image paths now upload.

Hopefully this hasn't broken anything else...

Thank you Jim.