1

How to restrict input file from accepting .pptx, .docx, .xlsx when using

  <input type="file" title="" onChange={handleUpload} accept=".zip" />

I want my input to only access .zip no other file type. But when I use the same in accept attribute it also allows .pptx, .docx, .xlsx

Payel Dutta
  • 742
  • 10
  • 23
  • 1
    Does this answer your question? [Limit file format when using ?](https://stackoverflow.com/questions/4328947/limit-file-format-when-using-input-type-file) – Schleis Aug 17 '21 at 18:21

1 Answers1

0

you would better use mimetype instead of extension

 <input type="file" title="" onChange={handleUpload} accept="application/zip" />
hamidreza
  • 9
  • 2