Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to use only one of multiple uploaders #4604

Closed
2 tasks done
anarkrypto opened this issue Jul 27, 2023 · 2 comments
Closed
2 tasks done

Allow to use only one of multiple uploaders #4604

anarkrypto opened this issue Jul 27, 2023 · 2 comments
Assignees
Labels

Comments

@anarkrypto
Copy link

anarkrypto commented Jul 27, 2023

Initial checklist

  • 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

Many times we need to use different services for different types of files.

Images should not necessarily use the same uploader or be uploaded to the same place as videos, PDFs, etc.

This commit #4218 reports the need to use @uppy/aws-s3 and @uppy/aws-s3-multipart depending on the file size.

In my case I need to use @uppy/aws-s3 for small files and @uppy/tus for videos that will be uploaded to Cloudflare Stream.

Uppy currently allow multiple uploaders per instance, but it uploads each file in each uploader always.

Solution

We need a way to optionally specify which uploader to use for different files, based on properties like fileType, size, source, isRemote or custom meta.

Add a method like onBeforeFileUpload in the .use(Plugin) options that returns a boolean or a modified file, just like onBeforeFileAdded:

uppy.use(Awss3Multipart, {
  onBeforeFileUpload(currentFile, files) {
    return currentFile.size > 1024 * 1024 * 1024
  }
})

Alternatives

Allow set the uploader in the .addFile method:

uppy.addFile({
  name: "image.png",
  data: file,
  uploader: 'plugin-name' // or an array of plugins instead
})
@anarkrypto anarkrypto changed the title Allow to use one of multiple uploaders Allow to use only one of multiple uploaders Jul 27, 2023
@arturi arturi self-assigned this Aug 16, 2023
@arturi
Copy link
Contributor

arturi commented Aug 22, 2023

Hi! We considered this with the team and decided it won’t be high on our list to implement, as similar functionality can be achieved on the server side or with a 3rd party service, like Transloadit — set up rules and sort files into different destinations, based on X.

However, if you are interested in contributing a PR, we’ll help.

@anarkrypto anarkrypto closed this as not planned Won't fix, can't repro, duplicate, stale Dec 8, 2023
@pcfreak30
Copy link

@arturi

I am finding a need for this as well, and having a backend service decide isn't an option. For now im going to need to patch one+ plugins to skip a file and use a custom provider for another case.

My case is simple: Need to use a post upload or a TUS upload based on filesize. Each goes to a different backend. Im also using uppy/core with a custom UI in react + tailwind and so not using the dashboard or other components.

I may end up submitting a PR for this at some point if no one else does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants