Unable to upload large files or no data received on "Save Article" page

Estimated Reading Time: 2 Minutes

If you are unable to see any content after clicking the "Preview Article" button or are unable to attach large files, then it is due to the size of the post data. If the size of post data is greater than post_max_size, the $_POST and $_FILES super-globals are empty, resulting in no content being sent to the "Save Article" page. In easy terms, the uploaded files are too large for your server to handle. Therefore, PHP discards POST data because of requests exceeding the post_max_size variable.

Upload Large Files in PHP

In order to upload large files in PHP, you need to increase the value of the post_max_size variable in the php.ini file or upload the files with a total file size lower than the post_max_size value. Also, the post_max_size  value must be larger than the  upload_max_filesize value. Values for the two settings above can be set in the php.ini (or maybe inside your .htaccess if the webserver’s config allows this) – usually this should be enough.

Also, take the notes below from the Official PHP Documentation into account:

About post_max_size variable:

It sets the max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize. If the memory limit is enabled by your configure script, memory_limit also affects file uploading. Generally speaking, memory_limit should be larger than post_max_size which in turn should be larger than upload_max_filesize. So, you might also need to change the value of the memory_limit variable in the php.ini file

So, in a nutshell memory_limit > post_max_size > upload_max_filesize

IMPORTANT: Please make sure to save the changes in the php.ini file and then restart your web server for the changes made in php.ini to take effect.

If you’re running PHP as FastCGI (FCGI) you might have to adapt FcgidMaxRequestLen too as explained here.

Another may be useful information if the webserver is set up with suPHP enabled:

In .htaccess should add this line: suPHP_ConfigPath /home/<user>/etc/php.ini This should be the path to the custom php.ini if the account is set up with suPHP enabled.

Unable to upload large files or no data received on "Save Article" page