I am using Dropzone from react-dropzone and want to upload only JPED files.
When I use accept="image/jpeg" on file opening dialog only JPEG files appearing but it is blocking other relating function incide onDrop
If user uploads other format files like png, pdf it should alert error message:
const ALLOWED_FORMAT = 'image/jpeg'
if (!ALLOWED_FORMAT.includes(acceptedFiles[i].type)) {
alert("Onlu JPEG files accepted")
break;
}
if I remove accept="image/jpeg" from Dropzone this function works as expected but I need to run both. If user uploads other formats this alter function should execute and alert error message! Where should I change or what should I add/remove?