![]() |
Definition and UsageThe accept attribute specifies the types of files that the server accepts (that can be submitted through a file upload). Note: The accept attribute can only be used with <input type="file">. Tip: Do not use this attribute as a validation tool. File uploads should be validated on the server. Applies toThe accept attribute can be used on the following element:
Specify that the server accepts only image files in the file upload. |
Example:
HTML
<!DOCTYPE html>
<html>
<body>
<h1>The input accept attribute</h1>
<form action="/action_page.php">
<label for="img">Select image:</label>
<input type="file" id="img" name="img" accept="image/*">
<input type="submit">
</form>
<p><strong>Note:</strong> Because of security issues, this example will not allow you to upload files.</p>
</body>
</html>
html accept |
How to Specify that the server accepts only image files in the file upload | HTML Attribute |
Read Full: | HTML Attribute |
Type: | Develop |
Category: | Web Tutorial |
Sub Category: | HTML Attribute |
Uploaded: | 2 weeks ago |
Uploaded by: | Admin |
Views: | 64 |
Reffered: https://www.w3schools.com/tags/att_accept.asp