Bird
0
0

What type of data structure is $_FILES in PHP when handling file uploads?

easy📝 Conceptual Q1 of 15
PHP - Superglobals and Web Context
What type of data structure is $_FILES in PHP when handling file uploads?
AAn integer representing the file size
BA string containing the file path
CA boolean indicating upload success
DAn associative array containing file upload information
Step-by-Step Solution
Solution:
  1. Step 1: Understand the role of $_FILES

    $_FILES is a superglobal array in PHP that stores information about files uploaded via HTTP POST.
  2. Step 2: Identify the data type of $_FILES

    It is an associative array where keys are the input field names and values are arrays with file details like name, type, size, tmp_name, and error.
  3. Final Answer:

    An associative array containing file upload information -> Option D
  4. Quick Check:

    Data structure = associative array [OK]
Quick Trick: Remember: $_FILES is always an associative array [OK]
Common Mistakes:
  • Thinking $_FILES is a string or integer
  • Confusing $_FILES with $_POST or $_GET
  • Assuming $_FILES is a boolean

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes