Why is the MAX_FILE_SIZE for an HTML <input type="file"> always in uppercase?
All examples I’ve seen do this. Why?
Is this something historical / are there lots of examples on the web which doesn’t use uppercase which I just didn’t see?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is not an HTML feature, but a PHP feature.
The documentation explains how PHP looks for a field named
MAX_FILE_SIZEin form data, and uses its value for handling file uploads if applicable.It’s a matter of historical convention that constants are capitalised and, traditionally, a field like
MAX_FILE_SIZEwould be a constant in an application. Matters are complicated slightly because, as far as PHP is concerned, it’s actually a variable (named$_POST['MAX_FILE_SIZE']) and isn’t constant at all; still, if you take the web application as a whole, you could see how this convention might still apply.It also sets the field name apart from any other fields that the user has in his/her form.
Note that, since access to arrays by string key is case-sensitive, it makes sense to assume that PHP’s search for this form field is also case-sensitive. So, if you were considering otherwise, stick with the capitalisation.