How does the enctype attribute in a form tag affect the transmission of form data in PHP?

The enctype attribute in a form tag specifies how form data should be encoded before sending it to the server. In PHP, if you are uploading files through a form, you need to set the enctype attribute to "multipart/form-data" to ensure that the file data is properly transmitted. Without setting the correct enctype, the file data may not be uploaded successfully.

<form action="upload.php" method="post" enctype="multipart/form-data">
    <input type="file" name="file">
    <input type="submit" value="Upload File">
</form>