What role does the enctype attribute play in file uploads in PHP forms?
The enctype attribute in HTML forms specifies how the form data should be encoded before sending it to the server. When dealing with file uploads in PHP forms, the enctype attribute should be set to "multipart/form-data" to allow files to be uploaded properly. Without setting the enctype attribute correctly, file uploads will not work as expected.
<form action="upload.php" method="post" enctype="multipart/form-data">
<input type="file" name="file">
<input type="submit" value="Upload File">
</form>