Why i still able to select all type file after Targeting pdf file via accept attribute? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why i still able to select all type file after Targeting pdf file via accept attribute?

Here's link: https://codepen.io/nur49/pen/xxEdVRZ

16th Dec 2020, 1:04 PM
NUR ISLAM
NUR ISLAM - avatar
2 Answers
+ 1
As W3Schools says, the accept attribute is not a validation mean. In fact, input of type file will accept any kind of file. File-type filtering is done by the FileDialog of the OS. The only purpose of the accept attribute is to inform the Browser what file-type the OS FileDialog should filter. So, the final behavior depends on the system/platform you're in.
17th Dec 2020, 12:34 PM
Erick Ruh Cardozo
Erick Ruh Cardozo - avatar
0
https://www.w3schools.com/tags/att_input_accept.asp <input type="file" accept="application/pdf" />
17th Dec 2020, 12:14 PM
Erick Ruh Cardozo
Erick Ruh Cardozo - avatar