I am trying to filter the file dialogue window using p-fileUpload from primeng.
I saw an example to to filter images as image/* and it works but i want ti filter for excel files. I tried file/excel, file/*.xls etc, but no help. Need help.
Advertisement
Answer
Try below inputs with accept property in p-fileUpload in Angular
-
Image filter
accept="image/*"[accepts all image file types]
accept="image/*.jpeg"[accepts only JPEG image file types] -
File filter
accept="application/msexcel"[accepts only xls file types]
accept=".xlsm,application/msexcel"[accepts only xls & xlsm file types]
accept="application/msmsword"[accepts only word file types]