Horje

How to Specify that the server accepts only image files in the file upload

The input accept attribute. Note: Because of security issues, this example will not allow you to upload files.
index.html
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>

Output should be:

How to Specify that the server accepts only image files in the file upload




Type:
html
Category:
Web Tutorial
Sub Category:
HTML Attribute
Uploaded by:
Admin