filefilter

HTML <input type='file'> apply a filter

给你一囗甜甜゛ 提交于 2019-11-26 22:37:59
<input type='file' name='userFile'> now when i will click the browse button, the browse dialog will show all files... what if i want to filter file types lets say only images or .png & .jpg & .gifs only office file like .doc & .docx & .pps how to do it... cHao There is an "accept" attribute on file input controls, where you can specify the types of files you want. From what i'm seeing, though, many browsers like to ignore it -- the file types that can be specified are MIME types, so a strictly correct browser would have to look at every file regardless of extension and see if it's an image