Beginners PHP Question: What the difference between $_POST and $_FILES?
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" />
)
$_POST and $_FILES are called 'superglobals'. $_POST contains the data from the form without displaying it in the url address. So it's safe in posting data. But for files you have to use $_FILES, because files can not be posted using $_POST.
Hope it will work for you.
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 )
精彩评论