nerdexam
GIAC

GPEN · Question #40

GPEN Question #40: Real Exam Question with Answer & Explanation

The correct answer is C. 5,000 bytes. The MAX_FILE_SIZE hidden field value in an HTML form is interpreted in bytes, so a value of 5000 sets a 5,000-byte upload limit.

Question

What is the maximum limit of the file size that a user can upload according to the code snippet given below? <form enctype="multipart/form-data" action="index.php" method="post"> <input type="hidden" name="MAX_FILE_SIZE" value="5000? /> <input name="filedata" type="file" /> <input type="submit" value="Send file" /> </form>

Options

  • A5,000 Kilobytes
  • B5,000 Megabytes
  • C5,000 bytes
  • D5,000 bits

Explanation

The MAX_FILE_SIZE hidden field value in an HTML form is interpreted in bytes, so a value of 5000 sets a 5,000-byte upload limit.

Common mistakes.

  • A. 5,000 kilobytes would require a value of 5,120,000 in the field, since the unit is bytes not kilobytes.
  • B. 5,000 megabytes would require a value of 5,242,880,000, as the field unit is bytes not megabytes.
  • D. Web file sizes are measured in bytes not bits, and 5,000 bits would be only 625 bytes - the PHP MAX_FILE_SIZE field does not operate in bit units.

Concept tested. PHP HTML form MAX_FILE_SIZE hidden field unit interpretation

Reference. https://www.php.net/manual/en/features.file-upload.post-method.php

Community Discussion

No community discussion yet for this question.

Full GPEN Practice