Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up

What is the correct approach to validating a file upload?

  1. A Trust the file extension supplied by the browser
  2. B Verify the real MIME type, cap the size, rename the file and store it outside the web root
  3. C Only check the file size
  4. D Rename the file to .php for processing
Answer

Verify the real MIME type, cap the size, rename the file and store it outside the web root

Extensions and the client-supplied type are trivially forged. Storing uploads outside the web root prevents direct execution.

All Php MCQs

Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up as