What is the significance of enctype="multipart/form-data" in a form for file uploads in PHP?

The enctype="multipart/form-data" attribute in a form is necessary when uploading files in PHP. This attribute tells the browser to encode the form data as multipart form data, which allows files to be uploaded. Without this attribute, 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>