We are cruising through this, but let's soldier on. The next attribute I want us to talk about is the...
accept attribute. The accept attribute is a space and/or comma separated list of content types or what's
known as internet media types that a server is supposed to handle correctly.
It looks like this. Say you only wanted the user to upload an image or JPEG file. And to reiterate, it...
tells the server what type of files it can
accept. This can be useful when uploading files, for example, to filter on the client side the types
that the server shouldn't be able to handle.
And this accept attribute is only really applicable with forms. It doesn't really apply to other HTML
elements. But ... ding ding ding ... redundancy alert.
This attribute has been removed, or what's known as "deprecated" since HTML5 came out.
But don't panic.
We're not just learning about it for the sake of it.
Although HTML5 has removed it, it is still in favor of you using the attribute on other form controls,
specifically on the input type file control. So we can still use it there.
Importantly, though, the accept attribute does not validate the type of selected file.
It simply provides hints for browsers to guide users towards selecting that correct file type.
What this means is that it's still possible for users to toggle an option in the file chooser...
that makes it possible to override this and select any file they wish and even upload an incorrect file...
type.
But we're going to get more to that later when we discuss this input type in a bit more detail. For now...
just realized that on the form element itself, this accept attribute has been removed.
You shouldn't use it directly on the form element.
Let's move on.