Beginners PHP Question: What the difference between $_POST and $_FILES?
PHP.net says:
$_POST is an associative array of variables passed to the current script via the HTTP POST method
$_FILES is an associative array of items uploaded to the current script via the HTTP POST method
Could anyone explain what this means in practical terms?
Both $_POST and $_FILES are so called in php "superglobals". They are predefined variables(arrays), which means they are available in all scopes throughout a script. There is no need to declare them to access them within functions or methods.
$_POST contains all the data from forms (except files)
$_FILES contains all files sent to server via forms (only from <input type="file" />
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With