#✅ How to upload a file to a "field" using API?

1 messages · Page 1 of 1 (latest)

fiery oyster
#

In the documentation I can see how to upload to the files storage, but cant find how to connect that file to a file field. Maybe it needs to be done in to steps? Can someone point o the right direction? thanks

grave epochBOT
#

Thanks for posting! This is a community powered server, so you may or may not get an answer based on available help and expertise. To increase your chances of somebody being able to help you, please help us help you making sure you:

  • Adding an explanation of exactly what you're trying to achieve.
  • Adding any and all related code or previous attempts.
  • Describing the exact issue or error you are facing.
  • Posting any screenshots if applicable.
  • Reading through https://stackoverflow.com/help/how-to-ask.

When you're done with this thread, please close it. Thanks! ✨

(If you have a support agreement and need help, please contact the core team via email.)

craggy condor
#

Connected files are a relation to the files collection. You can link them by UUID.

fiery oyster
#

Thanks @craggy condor for the quick reply,

yes I understand that, but it seems I need to pass the ID of that relation and not the UUID of the file, which make sense.
but when I upload the file to the /files endpoint I get only the UUID.

I see there was a new table created relating the files and the collection, do I need to do an api call to that table aswell to create the relation and then update the file field? I would prefer this to be handled all automatically by the backend with a single API call, if possible.

Can I you clarify what you mean?

thanks

craggy condor
fiery oyster
#

ah ok, it makes sense. Tested and worked perfectly.
thanks a lot for the help

grave epochBOT
#

✅ How to upload a file to a "field" using API?