react-butterfiles
react-butterfiles copied to clipboard
React-butterfiles only accepts PDF format
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
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 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
@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.