Saving upload URL to database with item ID?
I'm using UploadThing in my Next.js project to let my users upload an image for one of their items in their account.
So I need to get the image URL from UT into that specific item's record.
What's the best way to do this?
I thought the best way would be to make the DB update call in
ourFileRouter
as part of onUploadComplete()
, but I can't figure out how to pass the item ID into the UT function so ourFileRouter
could include that metadata on save.
I know I could do this in my client component where the upload button/dropzone is because I'm already within the context of knowing the item ID, but is this safe?
Thanks in advance!0 Replies