What is the purpose of using enctype="multipart/form-data" in PHP forms?

When submitting a form that includes file uploads in PHP, you need to use enctype="multipart/form-data" in the form tag. This encoding type allows files to be included in the form data being submitted, ensuring that the uploaded files are properly processed by the server.

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