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

Only allow one file selection for 'cover' non-multiple input #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jrochkind
Copy link
Contributor

The "cover" photo only accepts one file, but was resulting in a file open dialog that let you pick multiple files -- all but the first would be ignored by subsequent JS code.

This now demonstrates how to tell uppy to (tell the OS file selection dialog to) only allow one file selection.

Since we're just using the html "multiple" attribute, I'm not sure why uppy doesn't do this already as a default, it could conceivably be a feature PR to uppy. But in the meantime, why not have the demo be more solid and take care of this. Without this change, the demo lets me choose more than one file for 'cover' but they are all ignored; with this change, the demo file open dialog for 'cover' only lets me choose one file. (MacOS Chrome).

The "cover" photo only accepts one file, but was resulting in a file open dialog that let you pick multiple files -- all but the first would be ignored by subsequent JS code.

This now demonstrates how to tell uppy to (tell the OS file selection dialog to) only allow one file selection.

Since we're just using the html "multiple" attribute, I'm not sure why uppy doesn't do this already as a default, it could conceivably be a feature PR to uppy. But in the meantime, why not have the demo be more solid and take care of this. Without this change, the demo lets me choose more than one file for 'cover' but they are all ignored; with this change, the demo file open dialog for 'cover' only lets me choose one file. (MacOS Chrome).
@janko
Copy link
Collaborator

janko commented Feb 8, 2019

I initially added the limitation, but it turns out that when using the FileInput plugin, the maxNumberOfFiles option doesn't only limit the amount of files you can upload in one selection, but the total amount of files you can upload for that input. For example, with maxNumberOfFiles: 1, if I upload the file, then change my mind and want to upload a different file, I can't, because I already uploaded the maximum number of files I was allowed to (which is 1).

I think that behaviour doesn't make sense at all when using the FileInput plugin, so I opened an issue – transloadit/uppy#837. You can chime in there if you want.

The FileInput plugin should IMO provide an option for only toggling the multiple HTML attribute, but still allowing you to upload as much as you want. Or somehow change maxNumberOfFiles to mean "at once" instead of "in total".

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

Successfully merging this pull request may close these issues.

2 participants