I want an input type="file"
to accept only pdf and excel
I did this <input type="file" name="upload" accept="application/pdf,application/vnd.ms-excel" />
And it accepts .pdf and .xls files, but not .xlsx, how can I make it accept xlsx files as well?
I want an input type="file"
to accept only pdf and excel
I did this <input type="file" name="upload" accept="application/pdf,application/vnd.ms-excel" />
And it accepts .pdf and .xls files, but not .xlsx, how can I make it accept xlsx files as well?
Share Improve this question edited Jun 4, 2018 at 18:07 Latika Agarwal 9691 gold badge6 silver badges11 bronze badges asked Jun 4, 2018 at 18:01 Lizz ParodyLizz Parody 1,76513 gold badges31 silver badges50 bronze badges 5 |2 Answers
Reset to default 14Try following:
<input type="file" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" />
In modern browser you can also use file extensions directly like:
accept=".pdf, .xls, .xlsx"
Try using this and let me know !
<input type="file" accept=".pdf,.xls" />
EDIT Simply
<input type="file" accept="add all the extension of your choice separating by a comma " />
accept=".pdf, .xls"
? – Alon Eitan Commented Jun 4, 2018 at 18:04xlsx
? A quick google search suggestedapplication/vnd.openxmlformats-officedocument.spreadsheetml.sheet
– Fissure King Commented Jun 4, 2018 at 18:04