I am using
< input type="file" >to upload files.
To upload only selective files i am using "accept". So dialog box contains my selected types of files extension. But there is an option of "All Files" which i do not want there.
How can I remove this option?
The best you can do (natively) is to check which file was selected :
<input id="uploadFile" type="file" onchange="FileSelected(this)" />
Script :
function FileSelected(sender)
{
if (check(sender.value)) //check is you function to check extension
{...}
else
{...}
}
Sample code : ( check only jpg)
http://jsbin.com/sibose/2/edit
in chrome . ie10 you can do :
<!-- (IE 10+, Chrome) -->
<input type="file" accept=".xls,.xlsx">
With FF :
<!-- (IE 10+, Chrome, Firefox) -->
<input type="file"
accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel" />
demo : http://jsbin.com/jihoku/2/edit
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With