DropZone acceptedFiles type filter

More trial and error eventually turned up the solution:

Dropzone.options.dzone = {
acceptedFiles: "image/jpeg,image/png,image/gif"
}

Apparently my error was primarily in using jpg which made it all fail. The above works like a charm.


<Dropzone
   onDrop={this.handleFilesUpload}
   >
   {({ getRootProps, getInputProps }) => (
   <div {...getRootProps()}>
   <input
   {...getInputProps()}
   accept=".csv" /*you can use any file type */
   />
   <div className="drag-container">
      <img
         className="drag-img"
         src={Drag}
         alt="drag-img"
         />
      <p className="drag-container-para">Drop files here, or click to select files</p>
   </div>
   </div>
   )}
</Dropzone>

Tags:

Dropzone.Js