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

getFileList #5662

Open
2 tasks done
DavidPetrasek opened this issue Feb 25, 2025 · 4 comments
Open
2 tasks done

getFileList #5662

DavidPetrasek opened this issue Feb 25, 2025 · 4 comments
Labels

Comments

@DavidPetrasek
Copy link

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

I need to assign files back to an existing file input like this:
fileInput.files = uppy.getFiles();

Solution

Add a new method to uppy core:

getFileList() : FileList
{
    let dt = new DataTransfer();

    for (const uppyFile of this.getFiles()) 
    {
        dt.items.add(uppyFile.data);
    }
    
    return dt.files;
}

Alternatives


@Murderlon
Copy link
Member

To what existing input? We expose many events so you can do whatever you want at certain moments in time.

@DavidPetrasek
Copy link
Author

DavidPetrasek commented Feb 25, 2025

I have a form which has a file input with multiple attribute. In this case Uppy does not handle the file upload at all, but files are uploaded when the form is submitted. Uppy acts here as a mean to select multiple files before the actual upload. In order for the file input to be synced with Uppy, I need to assign FileList to the input every time when I add or remove file with Uppy. Is there any other way to achieve what I want without getting the actual FileList as described above?

@Murderlon
Copy link
Member

Have you looked at https://uppy.io/docs/form/?

@kvz kvz closed this as completed Mar 1, 2025
@kvz kvz reopened this Mar 1, 2025
@DavidPetrasek
Copy link
Author

DavidPetrasek commented Mar 3, 2025

Have you looked at https://uppy.io/docs/form/?

I don't need it since I already handle form submission. Also the example code inside index.html does not contain any file input so I am confused about its usage. Overall I don't believe Uppy should handle form submissions. Therefore I agree with #5509 that this plugin should be removed.

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