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
248 stars 91 forks source link

With Remix.js: click to select works, but not drag-and-drop (gives empty file) #142

Open tomsoderlund opened 2 months ago

tomsoderlund commented 2 months ago

I'm trying to use FileUploader with Remix.js. Selecting files in dialog works fine, but drag and drop submits this to my Remix.js action:

{
  size: 0,
  type: 'application/octet-stream',
  name: '',
  lastModified: 1724749194943
}

My code

  const formRef = useRef<HTMLFormElement>(null);

  const handleChange = (file: File) => {
    formRef.current?.submit();
  };

<FileUploader
  label='Click to upload relevant policies and documents here'
  handleChange={handleChange}
  name='uploadFile'
  types={FILE_TYPES_ACCEPTED}
/>

Any ideas why?