I have not found the examples how to accept any file type by <input type="file">
.
When I tried accept="*/*"
, I has been told
Bad value “/” for attribute “accept” on element “input”: Expected “/” but saw “*” instead."
by the HTML validator.
When I tried accept=""
, I has been told
Bad value “” for attribute “accept” on element “input”: Expected a MIME type but the literal ended."
by the HTML validator.
When I tried accept="*"
, I has been told
Bad value “” for attribute “accept” on element “input”: Expected “/” but saw “” instead."
by the HTML validator.
Why are you going to accept any type of files? Usually only one type of files required.
For example it is requires when developing the online files storage like the Google Drive.
2
Answers
List of all the official MIME types
If you really want to use
accept
attribute:Or just remove
accept
attribute :To accept any file type without HTML validity violations using the element, you can use the accept attribute with the value "/". Here’s an example:
The accept attribute specifies the types of files that the input accepts. By setting it to "/", you indicate that the input should accept any file type. This will prevent HTML validity violations related to file type restrictions.