Problem uploading files over php forms in Apache

Today I encountered the problem of uploading files that clearly do not exceed the post_max_size and upload_max_filesize limits. The following error appears:

Request Entity Too Large
The requested resource media-new.php does not allow request data with POST requests ...

Here is the picture: Screenshot from 2014-03-21 13:21:16

This error message is not related to php settings. This is a limitation in the Apache server in mod-security section.

In order to fix it, you need to add the following lines to .htaccess:

<IfModule mod_security.c>
  <Files media-new.php>
    #4Mb
    LimitRequestBody 4096000
  </Files>
</IfModule>

Thus, for the media-new.php file, a limit of 4Mb is set on the size of the request body.