react-butterfiles icon indicating copy to clipboard operation
react-butterfiles copied to clipboard

React-butterfiles only accepts PDF format

Open Misbah-Mushtaq opened this issue 1 year ago • 3 comments

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

Misbah-Mushtaq avatar May 10 '23 12:05 Misbah-Mushtaq

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

readeral avatar May 11 '23 02:05 readeral

@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 avatar May 11 '23 07:05 Misbah-Mushtaq

@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.

Misbah-Mushtaq avatar May 11 '23 10:05 Misbah-Mushtaq