Adding extra data into uploads

Hi. I'm just getting started using UploadThing in my new NextJS Application. I have uploads working great, and I am using onUploadComplete to store the entry in my Database. I want to make it so that the user can add extra data, more precisely how long the file should be stored for before it's automatically deleted, how many times someone can view the file, etc. Would this be possible with UploadThing, and if so, how? I am using NextJS and just followed the basic guide, nothing extra setup. Thanks. One workaround I think could work is letting the user add on that extra data before upload, and once the client callback is called, make a PATCH request to my API (which stores the upload info), and just update the database info there.
2 Replies
EnderTheNetrunner
https://docs.uploadthing.com/file-routes#middleware See if this doesn't fit your use case? Outside of that, your PATCH endpoint could def work.
File Routes - UploadThing Docs
File Routes is a core concept of UploadThing that defines what your users can upload
The Untraceable
The UntraceableOP5d ago
Nah not middleware. I need the user inputs the data alongside the upload of the file and I don't think middlewares can help with that. I might just go along with the PATCH method

Did you find this page helpful?