Save File ID after upload-success

Hi,

I have tried uploading the files using uppy to my local tusd installation.

When I upload the file, the upload-success console gives me uploadURL. Now, when I integrate this with my application, I would have to store the uploaded path/file ID into my database which I can then fetch later.

I do not want to store the URL as it may change later, how do i go about storing the file id ?

is this community Active ?

Hi! Apologies for the delay, I missed this when I got back from vacation.

Currently with the tus-js-client that Uppy uses, getting the response data from tusd is not possible. (I’m not sure if you can even change the data tusd responds with using a hook.)

My understanding of tusd is that you’d need a post-finish hook for something like this. It will be called after the file upload has completed, and you can save it to a DB from there or move the file somewhere else. If the file needs to be associated with eg. a user in your database, you can send data to the tusd server using tus metadata (setMeta and setFileMeta methods in Uppy). Eg. a token which is then used by the post-finish hook for authentication.

The specifics will depend a lot on your application, so I hope this helps as a starting point.

Hey @nikhilrishi was this helpful?