How can file data sent via post be properly recognized in PHP forms?

When sending file data via a form in PHP, you need to make sure that the form has the attribute `enctype="multipart/form-data"` set. This allows files to be properly recognized and processed by the PHP script. Additionally, you can access the file data using the `$_FILES` superglobal array in PHP.

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

<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $file = $_FILES["file"];
    $file_name = $file["name"];
    $file_tmp = $file["tmp_name"];
    $file_size = $file["size"];
    $file_error = $file["error"];
    
    // Process the file data here
}
?>