KarimMokhtar / react-drag-drop-files

Light and simple Reactjs drag and drop files library to use with very flexible options to change, so you put whatever the design you want for your drop-area. Users can drag and drop or even select the file anywhere in the window.
MIT License
245 stars 86 forks source link

Issue with file types #90

Open PrimozRome opened 1 year ago

PrimozRome commented 1 year ago

I am having problem with file types. I want to accept *.lic files, and I can not get it to work... Here is my code:

import { FileUploader } from "react-drag-drop-files";

const fileTypes = ['lic'];

<FileUploader 
  label="Drop your license (*.lic) file here"
  handleChange={handleChange} 
  name="file" 
  types={fileTypes} 
/>

When I drag and drop my file DWX-J13M-DRCI-JQR1.lic the component would say error File type/size error, Hovered on types!.

What am I doing wrong?

PrimozRome commented 1 year ago

Since my LIC files are basically XML files with LIC extension, I have tried the following:

import { FileUploader } from "react-drag-drop-files";

const fileTypes = ['xml'];

<FileUploader 
  label="Drop your license (*.lic) file here"
  handleChange={handleChange} 
  name="file" 
  types={fileTypes} 
/>

If I rename my LIC file to XML and drag and drop, then it is accepted. How do I achieve that my users can upload *.lic file

PrimozRome commented 1 year ago

Can anyone help?