Friday, 8 November 2013

html input file accept attribute

For Input file type opening window with particular file type using below code in html

for image files
Example:<input type="file" accept="image/jpeg,image/gif">

for pdf files
Example:<input type="file" accept="application/pdf">

for doc,docx,xls,xlsx

Example:<input type="file" accept=".doc/.docx/.xls/.xlsx">

these accept attributes work for all browsers.