Home > Back-end >  PHP 8.1 $_FILES missing type property
PHP 8.1 $_FILES missing type property

Time:05-16

I am upgrading my website from PHP 7.4 to 8.1 which is causing an unusual issue with $_FILES. I'm trying to upload a new file but nothing happens. This issue cannot be regarding the file size as I'm trying to upload .txt files containing a single word.

Example of my code:

<form action="client.php" method="POST" enctype="multipart/form-data" onSubmit="javascript: return validateFile(this);">
    <div >
        Upload Section
    </div>
    <div >
        <div >
            <label >Select file from local disk</label>
            <input  type="file" name="test" size="90" maxlength="500" >
        </div>
        <input  name='Submit' type='submit' value='Upload File'>
    </div>
</form>

When the from is posted the data within $_FILES is like so

test={ name="test.txt, full_path=test.txt, type="", tmp_name="", error={int} 6, size={int} 0}

CodePudding user response:

The PHP website did not have access to the "C:\WINDOWS\Temp" directory. Which was easily fixed by changing the security permissions.

  • Related