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

React-butterfiles only accepts PDF format #11

Open
Misbah-Mushtaq opened this issue May 10, 2023 · 3 comments
Open

React-butterfiles only accepts PDF format #11

Misbah-Mushtaq opened this issue May 10, 2023 · 3 comments

Comments

@Misbah-Mushtaq
Copy link

React-butterfiles only accepts PDF format.

I have started using this library for images, but now I want to upload documents as well, and I am trying to upload the given formats
Is there any way to do it?
".doc",
".docx",
".htm",
".html",
".odt",
".pdf",
".xls",
".xlsx",
".ppt",
".pptx",
".txt"

@adrians5j @readeral

@readeral
Copy link
Contributor

You're not restricted to PDF only, if your component only accepts PDF format you need to add more types to the accept prop array.

Have a read through the MDN entry on HTML drag and drop API, and the MIME type stuff, as this library is essentially a wrapper around that. https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItem/type

@Misbah-Mushtaq
Copy link
Author

@readeral can you please provide an example with the below given formats in accept prop?
I tried it earlier, and it is only picking up the PDF, though it is showing multiple formats while browsing, I have added a console to the onSuccess event, and it's only logging the input when I upload PDF format.
".doc",
".docx",
".htm",
".html",
".odt",
".pdf",
".xls",
".xlsx",
".ppt",
".pptx",
".txt"

If you could please provide an example with some of the above formats other than PDF? @readeral @adrians5j

@Misbah-Mushtaq
Copy link
Author

@readeral, I have noticed a particular scenario. If I give all these formats to accept props then it doesn't work as it should, but when I remove the prop and do it without the prop then it is accepting all types of documents.

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

No branches or pull requests

2 participants