EN
HTML - file input only for doc and docx
0 points
In this article, we would like to show you how to create file input only for document files in HTML.
Quick solution:
xxxxxxxxxx
1
<input type="file" accept=".doc,.docx">
In this example, we create file input using type="file"
attribute. To make it allow only documents, we set accept
attribute to the types that file input should accept.
xxxxxxxxxx
1
2
<html>
3
<body>
4
<label>
5
<span>Choose a file:</span>
6
<input type="file"
7
name="picture"
8
accept=".doc,.docx">
9
</label>
10
</body>
11
</html>