How to, only upload files that haven't previously been uploaded

Started by ckcabs4 replies585 views
ckcabsOriginal post
#1

Is there a way to check if a file has already been uploaded previously? so we don’t upload these again

many thanks

MerlijnTransloadit team
#2

If you try to upload the same file in the same session, uppy will know and prevent it. But if the user comes back at a later time then uppy doesn’t know. Depending on where you upload, you might be able to create a pre-processor that checks it.

#3

Hi Merlijn,
Yes if a user comes back at a later time

Any thoughts how you would go about this?

many thanks

MerlijnTransloadit team
#4

Example pre-processor: Building plugins | Uppy

Perhaps you could try to save the file IDs you get back from events, such as upload-success or complete, and put those in local storage.

Then in your pre-processor, or perhaps in onBeforeFileAdded, you check wether the ID already exists.

#5

I have a basic setup with Uppy as client and tusd as server.

Could I use the file.id in onBeforeFileAdded() and check if it exists on the server? Then I would have to know which percentage of the file was uploaded, because it could be a partial upload. In that case, the uploaded should not be discarded so it could be continued…

Is it more appropriate to do it using hooks?