React Dropzone prevent Internet Shortcut Files from showing up

13 Views Asked by At

I'm using react-dropzone for file uploads. Currently the only file type I'm accepting is .stl files, but when I click on the file upload box, the file explorer still shows Internet Shortcut files.

const { getRootProps, getInputProps, open } = useDropzone({
    accept: {
      "model/stl": [".stl"],
    },
    noClick: true,
    noKeyboard: true,
    maxFiles: 1,
    onDrop: (acceptedFiles) => {
      const file = acceptedFiles[0];
      const extension = file.name.split('.').pop();

      if (extension !== 'stl') {
        console.error('Invalid file type');
        return;
      }

      updateFile(file);
      addFileToScene(file);
    },
  });

I'm handling the case where an internet shortcut file is selected, but ideally these files won't even show up as an option to the user. Is there a way to hide these type of files so the user can't select them?

0

There are 0 best solutions below