/
File upload configuration check during installation

File upload configuration check during installation

There are 2 settings in php.ini related to uploads:

  • upload_max_filesize - total allowed size of all files on the form
  • post_max_size - maximal size of data, that is posted from a form (including all files to be uploaded)

In most server configuration I've seen they both are set to same value, which in reality would mean, that if somebody tries to upload a file, larger then allowed then server will not only not receive a file, but also miss whole form data, because together with uploaded file it would violate size from post_max_size setting.

To keep user from getting this weird errors about empty forms being submitted I propose to follow guidelines from http://lv1.php.net/manual/en/ini.core.php#ini.post-max-size page and ensure, that:

memory_limit (default: 128M) > post_max_size (default: 8M) > upload_max_filesize (default: 2M)

Before comparing any of these we need to convert any K (kilo), M (mega) and G (giga) to corresponding numbers.