Zend
200-530 · Question #30
An HTML form contains this form element <input type="file" name="myFile" /> When this form is submitted, the following PHP code gets executed: move_uploaded_file( $_FILES['myFile']['tmp_name']…
The correct answer is B. Sanitize the file name in $_FILES['myFile']['name'] because this value is not consistent among web D. Sanitize the file name in $_FILES['myFile']['name'] because this value could be forged. See the full explanation below for the reasoning.
Question
An HTML form contains this form element <input type="file" name="myFile" /> When this form is submitted, the following PHP code gets executed: move_uploaded_file( $_FILES['myFile']['tmp_name'], 'uploads/' . $_FILES['myFile']['name']); Which of the following actions must be taken before this code may go into production? (Choose 2)
Options
- ACheck with is_uploaded_file() whether the uploaded file $_FILES['myFile']['tmp_name'] is valid
- BSanitize the file name in $_FILES['myFile']['name'] because this value is not consistent among web
- CCheck the charset encoding of the HTTP request to see whether it matches the encoding of the
- DSanitize the file name in $_FILES['myFile']['name'] because this value could be forged
- EUse $HTTP_POST_FILES instead of $_FILES to maintain upwards compatibility
How the community answered
(60 responses)- A5% (3)
- B85% (51)
- C2% (1)
- E8% (5)
Community Discussion
No community discussion yet for this question.