What is the purpose of using enctype="multipart/form-data" in a form with file upload in PHP?

When uploading files in a form using PHP, it is important to set the enctype attribute of the form to "multipart/form-data". This encoding type allows files to be uploaded through the form submission. Without setting this attribute, the file data will not be properly sent to the server.

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