Open In App

HTML | <form> accept Attribute

Improve
Improve
Like Article
Like
Save
Share
Report

The <form> accept attribute in HTML is used to specifies the type of file that the server accepts. This attribute can be used with <input type=”file”> element only. This attribute is not used for validation tool because file uploads should be validated on the Server. 

Syntax: 

<form accept = "file_type";>

Attribute Values:

  • file_type: It can hold one or more file types that can be submitted/uploaded to the server. More than one file can be added and separated by a comma.

Example: 

html




<!DOCTYPE html>
<html>
 
<head>
    <title>
        HTML form accept attribute
    </title>
     
    <style>
        body {
            text-align: center;
        }
         
        h1 {
            color: green;
        }
    </style>
</head>
 
<body>
    <h1>GeeksForGeeks</h1>
     
    <h2>
        HTML Form accept attribute
    </h2>
     
    <form action=" "accept="image/*">
        <input type="file"
            name="picture">
         
        <input type="submit">
    </form>
</body>
 
</html>


Output: 

 

Supported Browsers: This attribute is not supported by any browsers.


Last Updated : 11 Jul, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads