You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I understand this is a feature request and questions should be posted in the Community Forum
I searched issues and couldn’t find anything (or linked relevant results below)
Problem
We often need to upload multiple files, each requiring different configurations. For instance, when using a service like Supabase storage with Tus, we need to include an authorization token that is unique for each file. This means the authorization token is only valid for the specific file that requested it.
Solution
To address this, we propose creating an event listener that fires before each upload attempt. For example, if there are three files, the event would trigger just before each file starts uploading, allowing us to adjust the configuration based on the file details. This ensures that each file can be uploaded with its unique settings.
Alternatives
na
The text was updated successfully, but these errors were encountered:
Hi, what about doing something like this with what we have already?
importUppyfrom"@uppy/core";importTusfrom"@uppy/tus";lettoken=null;asyncfunctiongetAuthToken(){constres=awaitfetch("/auth/token");constjson=awaitres.json();returnjson.token;}newUppy().use(Tus,{endpoint: "<your-endpoint>",// Called again for every retry too.asynconBeforeRequest(req){if(!token){token=awaitgetAuthToken();}req.setHeader("Authorization",`Bearer ${token}`);},asynconAfterResponse(req,res){if(res.getStatus()===401){token=awaitgetAuthToken();}},});
@Murderlon is exactly what was needed in my case. If I try to upload 3 images I can see that it generates 3 signedUploadTokens as what I needed. I wonder do it apply the correct tokens to the corresponding file. I asked because I notice that it seem to run my the function to get the signUploadToken all at the same time
Initial checklist
Problem
We often need to upload multiple files, each requiring different configurations. For instance, when using a service like Supabase storage with Tus, we need to include an authorization token that is unique for each file. This means the authorization token is only valid for the specific file that requested it.
Solution
To address this, we propose creating an event listener that fires before each upload attempt. For example, if there are three files, the event would trigger just before each file starts uploading, allowing us to adjust the configuration based on the file details. This ensures that each file can be uploaded with its unique settings.
Alternatives
na
The text was updated successfully, but these errors were encountered: