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

The accept parameter is ignored when dragging and dropping files. #92

Closed
claireryberg opened this issue Oct 21, 2020 · 2 comments
Closed
Labels
docs Improvements or additions to documentation

Comments

@claireryberg
Copy link

claireryberg commented Oct 21, 2020

Describe the bug
The accept parameter is ignored when dragging and dropping files. For example, when set to accept="image/*", non-image file types cannot get uploaded from the UploadButton but they are uploaded when dragging and dropping.

To Reproduce
Steps to reproduce the behavior:

  1. If you click the UploadButton in the provided codesandbox and the native file browser will appear. For me, using Chrome 85 on Mac Mojave, all non-image file types appear greyed out and cannot be selected.
  2. Open the Network tab in the dev tools
  3. Drag a non-image file into the UploadDropZone (I used a .mov type)
  4. A network request is triggered to upload the file

Expected behavior
Only file types that are listed in the accept parameter can be uploaded. In this case, a non-image would not trigger a network request, and there would be some kind of error response from Uploady.

Versions
"@rpldy/upload-button": "0.7.0",
"@rpldy/upload-drop-zone": "0.7.0",
"@rpldy/uploady": "0.7.0"

Code
https://codesandbox.io/s/uploady-example-55600

@yoavniran
Copy link
Collaborator

the accept parameter is indeed only for the file input.
I suggest using the fileFilter function to ensure you only upload the desired files, regardless of how they are provided

@claireryberg
Copy link
Author

I see, it wasn't clear to me that accept is scoped only to the file browser. Thanks!

@yoavniran yoavniran added the docs Improvements or additions to documentation label Oct 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants