When uploading files in PHP I'm currently checking for size errors and then checking them manually.
Is this second step necessary? Or is it sufficient just to check the errors.
(1) The second step is not necessary but you have to separate the UPLOAD_ERR_INI_SIZE
case from UPLOAD_ERR_FORM_SIZE
case because they have different meanings as the manual says
http://php.net/manual/en/features.file-upload.errors.php
(2) the value of the entry upload_max_filesize
at php.ini file is written using this notation:
XY: where X is an integer and Y is the unit, Y can be G(giga bytes), M (mega bytes)...etc, read the manual for more clarification
http://php.net/manual/en/faq.using.php#faq.using.shorthandbytes, so using (int)(ini_get('upload_max_filesize'));
will not be safe all times and requires extra handling