What is the purpose of using the enctype attribute in a form for file uploads in PHP?

When submitting a form that includes file uploads in PHP, it is important to set the enctype attribute of the form to "multipart/form-data". This is necessary because file uploads require a different encoding type than regular form data. Without setting the enctype attribute correctly, the file upload will not work properly.

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