HTML <input type="file">

Last Updated : 25 May, 2026

The HTML <input type="file"> element is used to allow users to select and upload files from their device. It is commonly used in forms for uploading documents, images, or other files.

  • Used to select and upload files from the user’s device.
  • Created using <input type="file"> inside a <form> element.
  • Supports attributes like accept, multiple, required, and disabled.

Syntax:

<input type="file"> 

Example: Demonstrate the use of the HTML <input type="file"> element.

HTML
<!DOCTYPE html>
<html>

<head>
    <title>
        HTML Input Type File
    </title>
</head>

<body style="text-align: center;">
    <h2>HTML &lt;input type = "file"&gt;</h2>

    <form action="#">
        <label for="image_file">Select Image</label>
        <input type="file" id="image_file">
    </form>
</body>

</html>
Comment