Upload File Size Error

Upload File Size Error – The Solution

The problem:

When executing some action, such as a file upload in site save/restore plugin you get an error like “Your file exceeds the maximum upload size for this site: 2MB”.  To solve this you need to increase the file size limit in your WordPress installation.

The Solution:

You will need to modify one or more of the following files:

  • wp-config.php
  • php.ini
  • .htaccess

In most cases just one will need modifying. For some installations, more than one will need to be changed.

For wp-config.php add the following lines near the end but just prior to “stop editing”:

  • @ini_set( ‘upload_max_filesize’ , ‘128M’ );
  • @ini_set( ‘post_max_size’, ‘128M’) ;
  • @ini_set( ‘memory_limit’, ‘256M’ );
  • @ini_set( ‘max_execution_time’, ‘300’ );
  • @ini_set( ‘max_input_time’, ‘300’ );

For php.ini modify the following lines:

  • post_max_size = 128M (This is usually set to 100M so may not be a problem for you)
  • upload_max_filesize = 128M

For the .htaccess file add these lines to the end of the file:

  • php_value upload_max_filesize 128MB
  • php_value post_max_size 128MB
  • php_value memory_limit 128MB

The wp-config.php should always be in the root WordPress directory.  This is the first file to try. The php.ini will likely be in the root/bin/php/… directory.  It might also be in the /etc/php… directory. For the Bitnami installation on AWS use  /opt/bitnami/php/etc/php.ini. The .htaccess file is the last resort.  It is found in most directories.  The target(s) directory(s) of your upload will need to be modified.

Once you have modifies the file(s) you will need to restart the servers.  On AWS use the following:

sudo /opt/bitnami/ctlscript.sh restart