Beginners PHP Question: What is the difference between $ _POST and $ _FILES?

Beginners PHP Question: What is the difference between $ _POST and $ _FILES?

PHP.net says:

$ _ POST - an associative array of passed variables to the current script using the HTTP POST method

$ _ FILES is an associative array of elements loaded into the current script using the HTTP POST method

Can someone explain what this means in practice?

+4
source share
3 answers

Both $ _ POST and $ _ FILES are so called in php "superglobals". These are predefined variables (arrays), which means that they are available in all areas in the script. There is no need to declare their access to them within functions or methods.

$ _ POST contains all form data (except files)

$ _ FILES contains all files sent to the server through forms (only from <input type="file" /> )

+9
source

$ _ POST and $ _FILES are called superglobals. $ _POST contains the data from the form without displaying it in the URL. Thus, it is safe when sending data. But for files, you must use $ _FILES, because files cannot be sent using $ _POST.

Hope this works for you.

+2
source

Both $ _POST and $ _FILES are so called in php "superglobals". These are predefined variables (arrays), which means that they are available in all areas in the script. There is no need to declare their access to them within functions or methods.

$ _ POST contains all form data (except files)

$ _ FILES contains all files sent to the server through forms (only from)

0
source

All Articles